|
-
Jan 8th, 2009, 10:46 AM
#1
Thread Starter
New Member
Help please
Can someone help me with a quick project.. The program consists of making 2 text boxes, one labeled Age, and one labeled Name.
The Name text box must return the name in all uppercase.
If the Age text box isn't filled with a numerical value, you should receive a message saying "need a number" and return your cursor to the age box.
2 command buttons "Process" and "Exit"
Any help? I tried getting started, but I usually always work better when i have a beginning!
Thanks!
-
Jan 8th, 2009, 10:59 AM
#2
-
Jan 8th, 2009, 11:05 AM
#3
Thread Starter
New Member
Re: Help please
okay i will give it a shot, thanks for your help!!
-
Jan 8th, 2009, 11:08 AM
#4
Thread Starter
New Member
Re: Help please
hey i tried that, it says runtime error... I am using Visual basic 6.0.... the directions i had were along the lines using the code Name=(ucase)....
do you know anything like this?
-
Jan 8th, 2009, 11:11 AM
#5
Re: Help please
Welcome to VBForums.
You could just set the TextBox' CharacterCasing property to Upper and everything written in the TextBox will always be all uppercase.
As for the numeric TextBox, this has been discussed over and over on VBF.
One way to do this is to not allow anything but numbers to be added in the first place, by doing something like this:
VB.NET Code:
Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If Not Char.IsNumber(Char.ConvertFromUtf32(e.KeyValue)) Then
e.SuppressKeyPress = True
End If
End Sub
Another way is to simply use a NumericUpDown instead, which is designed for just these kinds of things.
OR, keep the TextBox as is, and use Integer.TryParse:
VB.NET Code:
Dim value As Integer
If Integer.TryParse(TextBox1.Text, value) Then
'TextBox contained a valid integer. The variable value contains the integer.
Else
MessageBox.Show("Enter a valid integer")
End If
Edit: VB6 eh? Well... you've posted in the wrong forum then.
-
Jan 8th, 2009, 11:11 AM
#6
Hyperactive Member
-
Jan 8th, 2009, 11:12 AM
#7
Re: Help please
 Originally Posted by JJones34
I am using Visual basic 6.0....
Moved to Visual Basic 6 And Earlier
I'm not surprised you were getting an error. You were trying to run VB.NET code in a VB6 app.
Your use of UCase is correct.
-
Jan 8th, 2009, 11:15 AM
#8
Thread Starter
New Member
Re: Help please
okay, wow thanks for the timely help. You guys sure know what you're talking about! Thanks again... knxrb- could you get me the exact code to type in? It seems as if once i get the exact code, and make my own adjustments i learn much easier. That is how i got through Cobol!!
-
Jan 8th, 2009, 11:18 AM
#9
-
Jan 8th, 2009, 11:31 AM
#10
Thread Starter
New Member
Re: Help please
Thank you! .. things are starting to work! However, is there somehow I can get it to change the text in the box to uppercase... right now it just pops up a message saying txtName.text = MIKE
and is txtAge.text numeric = True
Can i Email you a copy of the compiled program?
-
Jan 8th, 2009, 11:33 AM
#11
Thread Starter
New Member
Re: Help please
I have a working .exe of the program, however my version is still a little different then the correct .exe program... do you have an email i can forward it too, its a really small program, doesn't take more than 10 seconds to download.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|