-
April 20th, 2008, 02:01 PM
#16
Re: Problem with module and form load slow
Because nobody else would type 30000 lines rather than 10.
Code:
If Val(Options1.Textbox.Text) >= 32 Then
Testbox.ShowDialog()
End If
You enter 33 into the textbox, which IS greater than 32, so you get the message. That is what you wanted?
-
April 20th, 2008, 04:28 PM
#17
Re: Problem with module and form load slow
Yes but the main problem is when I type 33 on the textbox, it should be displaying the messagebox but I have received an error:
Value of '65' is not valid for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'.
The maximum number is only 32 for trackbar, I wanted the textbox to check if I go over the limit numbers of value on trackbar and display straight away if I go over the limit numbers??
Hope you can help.
Thanks,
Mark
-
April 20th, 2008, 05:38 PM
#18
Re: Problem with module and form load slow
Did you mark the textbox to be VALIDATE(d)? It won't let you exit with the wrong numbers? That's where you need to change the message, if you don't like it.
Usually validation is all that's required. They won't be able to enter anything higher than Maximum
-
April 20th, 2008, 06:50 PM
#19
Re: Problem with module and form load slow
No I haven't, so how I can change the textbox to be validate??
Thanks,
Mark
-
April 20th, 2008, 08:21 PM
#20
Re: Problem with module and form load slow
search for that exact error message to find where it's being called.
where did you get the textbox code? it must have a validate event somewhere.
again, search for it.
-
April 21st, 2008, 08:49 AM
#21
Re: Problem with module and form load slow
Last edited by Oblio; April 21st, 2008 at 09:12 AM.
-
April 21st, 2008, 12:26 PM
#22
Re: Problem with module and form load slow
-
April 21st, 2008, 02:16 PM
#23
Re: Problem with module and form load slow
Can you explain what it is your module is meant to be doing (one paragraph will be fine, not 35,000)? If we could understand what you were doing then we can better understand how to help you and reduce the size of that horrendous chunk of code you have there and maybe even teach your a few coding best practices along the way.
-
April 21st, 2008, 03:52 PM
#24
Re: Problem with module and form load slow
@Oblio: Will you please stop posting any spams that I have received from you. Read the forum rules and if you continue to spam then you will be banned. Just post the info to this forum which it much welcome. Simple as that.
@visualAd: Well on my method they are doing to move the value from 0 to 32 when I type on the textbox so from 33 to any of the highest value I wanted to receive the messagebox when I type the high numbers on the textbox but I have received an error for the same reasons. I tried to use this code but it didn't solve it correctly
Code:
If Val(Form2.Textbox.Text = "32") <= 31 Then
Form2.TrackBar2.Value = Val(Form2.Textbox.Text)
ElseIf Val(Form2.Textbox.Text = "33") >= 32 Then
Testbox.ShowDialog()
End If
I know that the trackbar2 has maximum number up to 32 but I would be happy to ignore the code for controlling when I type the highest value just after 32. Hope you guys can help me out and get this problem right away.
Thanks,
Mark
-
April 21st, 2008, 04:09 PM
#25
Re: Problem with module and form load slow
Originally Posted by mark103
@Oblio: Will you please stop posting any spams that I have received from you. Read the forum rules and if you continue to spam then you will be banned. Just post the info to this forum which it much welcome. Simple as that.
@visualAd: Well on my method they are doing to move the value from 0 to 32 when I type on the textbox so from 33 to any of the highest value I wanted to receive the messagebox when I type the high numbers on the textbox but I have received an error for the same reasons. I tried to use this code but it didn't solve it correctly
Code:
If Val(Form2.Textbox.Text = "32") <= 31 Then
Form2.TrackBar2.Value = Val(Form2.Textbox.Text)
ElseIf Val(Form2.Textbox.Text = "33") >= 32 Then
Testbox.ShowDialog()
End If
I know that the trackbar2 has maximum number up to 32 but I would be happy to ignore the code for controlling when I type the highest value just after 32. Hope you guys can help me out and get this problem right away.
Thanks,
Mark
Anyone who uses the Val function needs to be shot. Use the Integer.Parse / Float.Parse functions.
Now after reading your previous post it looks like you are still describing the problem. We know that you have a problem, however, in order to help you solve the problem we need to understand what you are trying to achieve. Forget about the code you have posted so far (delete it for all I care - just don't post it again ) and tell us what the code is doing. Even better, if it is related to a real world scenario tell us what it is because there is probably already an algorithm out there that works well and even if there is not it will help us to understand.
-
April 21st, 2008, 04:14 PM
#26
Re: Problem with module and form load slow
Originally Posted by mark103
@Oblio: Will you please stop posting any spams that I have received from you. Read the forum rules and if you continue to spam then you will be banned. Just post the info to this forum which it much welcome. Simple as that.
Leave the hiring and firing to HR and just concentrate on not getting banned from this forum too
-
April 21st, 2008, 04:59 PM
#27
Re: Problem with module and form load slow
Originally Posted by visualAd
Anyone who uses the Val function needs to be shot. Use the Integer.Parse / Float.Parse functions.
That's a little harsh. Yes VAL is a vb6 function but it still works in .NET. And yes he should use the .parse or possibly ctype. No need to be rude about it.
In this code...
Code:
If Val(Form2.Textbox.Text = "32") <= 31 Then
Form2.TrackBar2.Value = Val(Form2.Textbox.Text)
ElseIf Val(Form2.Textbox.Text = "33") >= 32 Then
Testbox.ShowDialog()
End If
...I don't think it is doing what you think it is. And I am not sure how the VAL function would do this, however, I think it would be parsed like this.
Does " Form2.Textbox.Text = "32" " If the answer is yes, take the val of true which would equal 1. If no, take the val of false which should be 0. Either case would then be less than or equal to 31 and you will always try to set the value of the trackbar to whatever the value is in form2.textbox.text. I think what you are looking for is something like this.
Code:
If CType(Form2.Textbox.Text, Integer) <= 31 Then
Form2.TrackBar2.Value = CType(Form2.Textbox.Text,Integer)
Else
Testbox.ShowDialog()
End If
-
April 21st, 2008, 05:41 PM
#28
Re: Problem with module and form load slow
Originally Posted by sotoasty
That's a little harsh.....
Sorry, I should have added a face to the end of that. Yes Val is in VB6 however I would generally stay away from it then, unless you generally do not know the data type of the data which will be entered.
Anyhow rest assured I did not intend to be rude. May be I should rephrase "using VAL is shooting yourself in the foot"
-
April 21st, 2008, 07:15 PM
#29
Re: Problem with module and form load slow
Code:
Dim tbVAL As Integer = 0
If Integer.TryParse(TextBox1.Text, tbVAL) Then
If tbVAL >= 0 AndAlso tbVAL <= 32 Then TrackBar1.Value = tbVAL Else TrackBar1.Value = TrackBar1.Maximum
Else
MessageBox.Show("Numbers Only Please")
End If
@mark, please don't tell me what to do. i posted those links so people would see what they are dealing with. i don't mean this in a mean way, but you need an intro to visual basic programming class.
e.g. What do you think this means
If Val(Form2.Textbox.Text = "32") <= 31
Did you understand the explanation?
@sotoasty - in one thread at MSDN mark103 told someone they were a f'ing c*nt. i am beginning to believe this is a joke.
Last edited by Oblio; April 21st, 2008 at 07:29 PM.
-
April 21st, 2008, 07:32 PM
#30
Re: Problem with module and form load slow
Oblio - turn on your PM's
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
|