|
-
May 2nd, 2008, 05:46 PM
#1
[RESOLVED] Write method in short way for my textbox
Hi guys
I have a problem with method. I have trackbar with maximum value number up to 10000. When I write the value numbers from 0 to 999 on the textbox, the trackbar value moved as it works ok so far. On 1.0 where I want the trackbar value must be target on 1000, if I go over the limit like 1.1, I want the warning message pop up. But on mine I have to write the longest code from 1.0 (the trackbar maximum target 1000) to 100.0 (trackbar maximum target 2000). I don't want to write that crazy numbers to make my form slowing down.
Here it the code:
Code:
If Form2.Textbox.Text = 1.1 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
If Form2.Textbox.Text = 1.2 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
If Form2.Textbox.Text = 1.3 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
If Form2.Textbox.Text = 1.4 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
If Form2.Textbox.Text = 1.5 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
If Form2.Textbox.Text = 1.6 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
If Form2.Textbox.Text = 1.7 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
If Form2.Textbox.Text = 1.8 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
If Form2.Textbox.Text = 1.9 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
If Form2.Textbox.Text = 2.0 Then
Form2.TrackBar2.Value = 1000
Textbox.ShowDialog()
End If
End If
ETC.....
What is the short way of writing the code in proper way??
Thanks,
Mark
Last edited by mark103; May 2nd, 2008 at 05:52 PM.
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
|