 |
|
|
|
| Author |
Message |
bobs
Joined: 04 Oct 2007 Posts: 3
|
Posted: Tue Apr 10, 2007 10:03 pm Post subject: Inputbox prepopulate |
|
|
How can I prepopulats an inputbox?
userinfo = inputbox(Type in the path to your server")
I want the above inputbos prepopulated with \\servername\users\. So all they
have to do is type in the username.
Thanks
Archived from group: microsoft>public>vb>syntax |
|
| Back to top |
|
 |
"Rick Rothstein \
Joined: 04 Oct 2007 Posts: 1584
|
Posted: Tue Apr 10, 2007 10:12 pm Post subject: Re: Inputbox prepopulate |
|
|
> How can I prepopulats an inputbox?
>
> userinfo = inputbox(Type in the path to your server")
>
> I want the above inputbos prepopulated with \\servername\users\. So all
> they have to do is type in the username.
I don't think you can, but you can change the prompt to say "Type in your
username" and once you have that from the user, concatenate the path stuff
onto the front of it.
UserInfo = InputBox("Type in your username")
PathToUser = "\\servername\users\" & UserInfo
Another possibility is to do away with the InputBox and create your own
"input box" from a Form, Label and TextBox. If you did that, you can
pre-populate the TextBox with whatever text you wanted.
Rick |
|
| Back to top |
|
 |
Karl E. Peterson
Joined: 04 Oct 2007 Posts: 4836
|
Posted: Tue Apr 10, 2007 7:20 pm Post subject: Re: Inputbox prepopulate |
|
|
Rick Rothstein (MVP - VB) wrote:
>> How can I prepopulats an inputbox?
>>
>> userinfo = inputbox(Type in the path to your server")
>>
>> I want the above inputbos prepopulated with \\servername\users\. So all
>> they have to do is type in the username.
>
> I don't think you can, but you can change the prompt to say "Type in your
> username" and once you have that from the user, concatenate the path stuff
> onto the front of it.
Nah... Check the [optional] third parameter:
UserInfo = InputBox("Prompt", , "\\servername\users\")
--
..NET: It's About Trust!
http://vfred.mvps.org |
|
| Back to top |
|
 |
"Rick Rothstein \
Joined: 04 Oct 2007 Posts: 1584
|
Posted: Wed Apr 11, 2007 12:10 am Post subject: Re: Inputbox prepopulate |
|
|
>>> How can I prepopulats an inputbox?
>>>
>>> userinfo = inputbox(Type in the path to your server")
>>>
>>> I want the above inputbos prepopulated with \\servername\users\. So all
>>> they have to do is type in the username.
>>
>> I don't think you can, but you can change the prompt to say "Type in your
>> username" and once you have that from the user, concatenate the path
>> stuff
>> onto the front of it.
>
> Nah... Check the [optional] third parameter:
>
> UserInfo = InputBox("Prompt", , "\\servername\users\")
Okay, yeah, I guess that would work too.
It just goes to show you how much I use the InputBox... I didn't remember it
had optional arguments at all!
Rick |
|
| Back to top |
|
 |
Karl E. Peterson
Joined: 04 Oct 2007 Posts: 4836
|
Posted: Wed Apr 11, 2007 1:06 pm Post subject: Re: Inputbox prepopulate |
|
|
Rick Rothstein (MVP - VB) wrote:
>>>> How can I prepopulats an inputbox?
>>>>
>>>> userinfo = inputbox(Type in the path to your server")
>>>>
>>>> I want the above inputbos prepopulated with \\servername\users\. So all
>>>> they have to do is type in the username.
>>>
>>> I don't think you can, but you can change the prompt to say "Type in your
>>> username" and once you have that from the user, concatenate the path
>>> stuff
>>> onto the front of it.
>>
>> Nah... Check the [optional] third parameter:
>>
>> UserInfo = InputBox("Prompt", , "\\servername\users\")
>
> Okay, yeah, I guess that would work too.
>
> It just goes to show you how much I use the InputBox... I didn't remember it
> had optional arguments at all!
Yep, I think 99% of the time I use it is in demos. Actually, given I've probably
used it less than 20 times since VB1 shipped, I suppose it'd be more accurate to say
95%?
--
..NET: It's About Trust!
http://vfred.mvps.org |
|
| Back to top |
|
 |
"Rick Rothstein \
Joined: 04 Oct 2007 Posts: 1584
|
Posted: Wed Apr 11, 2007 4:20 pm Post subject: Re: Inputbox prepopulate |
|
|
>>>>> How can I prepopulats an inputbox?
>>>>>
>>>>> userinfo = inputbox(Type in the path to your server")
>>>>>
>>>>> I want the above inputbos prepopulated with \\servername\users\. So
>>>>> all
>>>>> they have to do is type in the username.
>>>>
>>>> I don't think you can, but you can change the prompt to say "Type in
>>>> your
>>>> username" and once you have that from the user, concatenate the path
>>>> stuff
>>>> onto the front of it.
>>>
>>> Nah... Check the [optional] third parameter:
>>>
>>> UserInfo = InputBox("Prompt", , "\\servername\users\")
>>
>> Okay, yeah, I guess that would work too.
>>
>> It just goes to show you how much I use the InputBox... I didn't remember
>> it
>> had optional arguments at all!
>
> Yep, I think 99% of the time I use it is in demos. Actually, given I've
> probably used it less than 20 times since VB1 shipped, I suppose it'd be
> more accurate to say 95%?
You know, in thinking about it, I'm not sure I like using the 3rd parameter
for the OP's original situation. The text specified for that parameter will
show in the InputBox highlighted (selected), so the user will have to either
click the mouse to the right of the selected text, or hit the right arrow
key, to place the cursor at the end of the defaulted text in a deselected
state (remember, the OP wanted the user to add his/her username to the path,
not replace it). I'll bet many users will screw this up and simply start
typing over the selected text. Also, showing the defaulted path that way
means a user can modify (accidentally, of course) the text thus
invalidating the path for the program. I kind of like my suggestion more,
just ask the user for his/her username and concatenate the server path in
front of it afterwards. Of course, in a real program, the server path would
be user configurable in a preference dialog (in case servers were switched
later on), but defaulted to the specified server on the program's first use
(if the storage location for the server path is blank, use the hard-coded
one; otherwise, use whatever has been stored by the program).
Rick |
|
| Back to top |
|
 |
Karl E. Peterson
Joined: 04 Oct 2007 Posts: 4836
|
Posted: Wed Apr 11, 2007 2:31 pm Post subject: Re: Inputbox prepopulate |
|
|
Rick Rothstein (MVP - VB) wrote:
>>>>>> How can I prepopulats an inputbox?
>>>>>>
>>>>>> userinfo = inputbox(Type in the path to your server")
>>>>>>
>>>>>> I want the above inputbos prepopulated with \\servername\users\. So
>>>>>> all
>>>>>> they have to do is type in the username.
>>>>>
>>>>> I don't think you can, but you can change the prompt to say "Type in
>>>>> your
>>>>> username" and once you have that from the user, concatenate the path
>>>>> stuff
>>>>> onto the front of it.
>>>>
>>>> Nah... Check the [optional] third parameter:
>>>>
>>>> UserInfo = InputBox("Prompt", , "\\servername\users\")
>>>
>>> Okay, yeah, I guess that would work too.
>>>
>>> It just goes to show you how much I use the InputBox... I didn't remember
>>> it
>>> had optional arguments at all!
>>
>> Yep, I think 99% of the time I use it is in demos. Actually, given I've
>> probably used it less than 20 times since VB1 shipped, I suppose it'd be
>> more accurate to say 95%?
>
> You know, in thinking about it, I'm not sure I like using the 3rd parameter
> for the OP's original situation. The text specified for that parameter will
> show in the InputBox highlighted (selected), so the user will have to either
> click the mouse to the right of the selected text, or hit the right arrow
> key, to place the cursor at the end of the defaulted text in a deselected
> state (remember, the OP wanted the user to add his/her username to the path,
> not replace it). I'll bet many users will screw this up and simply start
> typing over the selected text. Also, showing the defaulted path that way
> means a user can modify (accidentally, of course) the text thus
> invalidating the path for the program. I kind of like my suggestion more,
> just ask the user for his/her username and concatenate the server path in
> front of it afterwards. Of course, in a real program, the server path would
> be user configurable in a preference dialog (in case servers were switched
> later on), but defaulted to the specified server on the program's first use
> (if the storage location for the server path is blank, use the hard-coded
> one; otherwise, use whatever has been stored by the program).
I actually agree with that reasoning, but was just answering the question as posed.
Sometimes, aerating one's own foot can be invigorating!
--
..NET: It's About Trust!
http://vfred.mvps.org |
|
| Back to top |
|
 |
bobs
Joined: 04 Oct 2007 Posts: 3
|
Posted: Thu Apr 12, 2007 12:52 am Post subject: Re: Inputbox prepopulate |
|
|
Wow! I can't believe the response I got. I have clearly hit the Mother load
of Info. I did use Rick's suggestion, and it was exactly what the doctor
ordered. I'm sure there are other ways to do this, but I am a VB script
newbee, and I'm just going to take it one step at a time. I'm making a add
user vbscript for my company, and when I get this script done I gonna create
a full blown App out it using VB.net as a training excersise.
I want to thank you all.
"Karl E. Peterson" wrote in message
news:%23ZmUL9FfHHA.1244@TK2MSFTNGP04.phx.gbl...
> Rick Rothstein (MVP - VB) wrote:
>>>>>>> How can I prepopulats an inputbox?
>>>>>>>
>>>>>>> userinfo = inputbox(Type in the path to your server")
>>>>>>>
>>>>>>> I want the above inputbos prepopulated with \\servername\users\. So
>>>>>>> all
>>>>>>> they have to do is type in the username.
>>>>>>
>>>>>> I don't think you can, but you can change the prompt to say "Type in
>>>>>> your
>>>>>> username" and once you have that from the user, concatenate the path
>>>>>> stuff
>>>>>> onto the front of it.
>>>>>
>>>>> Nah... Check the [optional] third parameter:
>>>>>
>>>>> UserInfo = InputBox("Prompt", , "\\servername\users\")
>>>>
>>>> Okay, yeah, I guess that would work too.
>>>>
>>>> It just goes to show you how much I use the InputBox... I didn't
>>>> remember
>>>> it
>>>> had optional arguments at all!
>>>
>>> Yep, I think 99% of the time I use it is in demos. Actually, given I've
>>> probably used it less than 20 times since VB1 shipped, I suppose it'd be
>>> more accurate to say 95%?
>>
>> You know, in thinking about it, I'm not sure I like using the 3rd
>> parameter
>> for the OP's original situation. The text specified for that parameter
>> will
>> show in the InputBox highlighted (selected), so the user will have to
>> either
>> click the mouse to the right of the selected text, or hit the right arrow
>> key, to place the cursor at the end of the defaulted text in a deselected
>> state (remember, the OP wanted the user to add his/her username to the
>> path,
>> not replace it). I'll bet many users will screw this up and simply start
>> typing over the selected text. Also, showing the defaulted path that way
>> means a user can modify (accidentally, of course) the text thus
>> invalidating the path for the program. I kind of like my suggestion more,
>> just ask the user for his/her username and concatenate the server path in
>> front of it afterwards. Of course, in a real program, the server path
>> would
>> be user configurable in a preference dialog (in case servers were
>> switched
>> later on), but defaulted to the specified server on the program's first
>> use
>> (if the storage location for the server path is blank, use the hard-coded
>> one; otherwise, use whatever has been stored by the program).
>
> I actually agree with that reasoning, but was just answering the question
> as posed.
>
> Sometimes, aerating one's own foot can be invigorating!
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
> |
|
| Back to top |
|
 |
Karl E. Peterson
Joined: 04 Oct 2007 Posts: 4836
|
Posted: Wed Apr 11, 2007 10:02 pm Post subject: Re: Inputbox prepopulate |
|
|
bobs wrote:
> Wow! I can't believe the response I got. I have clearly hit the Mother load
> of Info. I did use Rick's suggestion, and it was exactly what the doctor
> ordered. I'm sure there are other ways to do this, but I am a VB script
> newbee, and I'm just going to take it one step at a time. I'm making a add
> user vbscript for my company, and when I get this script done I gonna create
> a full blown App out it using VB.net as a training excersise.
>
> I want to thank you all.
Ummm, I hate to spoil the fun, but it would've helped tremendously if you'd told us
what language you were using up front. The answers you got were for *Classic VB*,
which is moderatly different from VBScript, and wholly different from VFred
(occassionally, and generally with scorn, called VB.NET). You may want to find
groups dedicated to those topics, for the most on-point responses.
Sorry... Karl
--
..NET: It's About Trust!
http://vfred.mvps.org |
|
| Back to top |
|
 |
bobs
Joined: 04 Oct 2007 Posts: 3
|
Posted: Thu Apr 12, 2007 3:30 am Post subject: Re: Inputbox prepopulate |
|
|
I got the information I needed. What seems to be the problem? I will also
continue to call the product that I own Visual Basic.net 2003 since that is
what it says on the box.
"Karl E. Peterson" wrote in message @TK2MSFTNGP04.phx.gbl...
> bobs wrote:
>> Wow! I can't believe the response I got. I have clearly hit the Mother
>> load
>> of Info. I did use Rick's suggestion, and it was exactly what the doctor
>> ordered. I'm sure there are other ways to do this, but I am a VB script
>> newbee, and I'm just going to take it one step at a time. I'm making a
>> add
>> user vbscript for my company, and when I get this script done I gonna
>> create
>> a full blown App out it using VB.net as a training excersise.
>>
>> I want to thank you all.
>
> Ummm, I hate to spoil the fun, but it would've helped tremendously if
> you'd told us what language you were using up front. The answers you got
> were for *Classic VB*, which is moderatly different from VBScript, and
> wholly different from VFred (occassionally, and generally with scorn,
> called VB.NET). You may want to find groups dedicated to those topics,
> for the most on-point responses.
>
> Sorry... Karl
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
> |
|
| Back to top |
|
 |
"Rick Rothstein \
Joined: 04 Oct 2007 Posts: 1584
|
Posted: Thu Apr 12, 2007 3:50 am Post subject: Re: Inputbox prepopulate |
|
|
>I got the information I needed. What seems to be the problem? I will also
>continue to call the product that I own Visual Basic.net 2003 since that is
>what it says on the box.
In time, you will want to try more complicated programming technique and,
since this group is devoted to VB6 (and earlier), the vast majority of
answers you get here will be oriented to that language. Because the VB.NET
world (the versions of what Microsoft continued to call Visual Basic) is
considerably different from the classic VB world (the versions prior to
VB.NET), our answers at that time will be more confusing to you than they
will be helpful. On the other hand, there are newsgroups devoted to the
VB.NET style of programming... you will find 100% of the people there are
using the same style language that you are, so their answers will be **way**
more helpful to you.
For your consideration, here is my standard response when a poster asks a
VB.NET question...
Almost everybody in this newsgroup is using VB6 or lower (this is the case
for all newsgroups with ".vb." in the name). While you may get a stray
answer to VB.NET (including VB2003, VB2005 and VB Express which have dropped
..NET from their names) questions here, you should ask them in newsgroups
devoted exclusively to .NET programming (the languages are different enough
to warrant separate newsgroup support). Look for newsgroups with either the
word "dotnet" or "vsnet" in their name.
For the microsoft news server, try these newsgroups for Visual Basic .NET
related questions...
microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.upgrade
microsoft.public.dotnet.languages.vb.controls
microsoft.public.dotnet.languages.vb.data
And these for more general .NET questions
microsoft.public.dotnet.general
microsoft.public.vsnet.general
Note: There are many other .NET newgroups (use the first three "fields" from
the last two as templates when searching for them), but the above ones
should get you started.
Rick |
|
| Back to top |
|
 |
Ken Halter
Joined: 04 Oct 2007 Posts: 4150
|
Posted: Thu Apr 12, 2007 11:12 am Post subject: Re: Inputbox prepopulate |
|
|
"bobs" wrote in message @TK2MSFTNGP02.phx.gbl...
>I got the information I needed. What seems to be the problem? I will also
>continue to call the product that I own Visual Basic.net 2003 since that is
>what it says on the box.
What's the problem helping people that are trying to do you a favor, by
telling them as much information as you can to make it easier on everyone
involved?
Note that "the product that I own Visual Basic.net 2003" is not supported on
Vista. Good luck.
--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
|
|
| Back to top |
|
 |
|
|
| Related Topics: | Probably a simple Inputbox problem Dear All, I'm trying to write a gotfocus sub for one of my options in an option group, if the option is selected I want the user to input a date for use in the overall form but if it's left blank it inputs today's date. The code I've got so far is listed
Can an InputBox have multiple entry points? What I mean is that if I wanted to have someone verify the text in an InputBox, for example verifying a password, how does that happen code-wise? -- Regards...
InputBox Hangs in Compilied Program Using an vb InputBox for user to enter data. Program runs fine in Debug mode. After I compile the executable, the InputBox will hang when using Keyboard Enter Key.
Setting Font of Msgbox / Inputbox Can somebody tell me of it is possible to set the Font for the Msgbox and Inputbox in VB6. Changing the font of the form don't help. Gérard.
VB inputbox ? How to check if user clicked OK or Cancel ? How can I determine in VB Inputbox whether user clicked OK or cancel ? I want to check, if user clicked OK, and he did not enter anything, then program should not allow him to go further, however if he did not enter anything and press Cancel, program shou |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|