doneQuote:
Originally Posted by dglienna
Printable View
doneQuote:
Originally Posted by dglienna
So shoot me ;) .. I often forget if i'm posting in VB6 or .NET ... I've been programming VB(4/5/6) for so long i'm stuck in those methods.. I'm still picking up the .NET way .... please give me a break... ;)Quote:
Originally Posted by visualAd
The correct method should have been@Mark .. Bdl check what line is throwing that error.. then also what min and max values have you set for the Trackbar ???Code:If Cint(Form2.Textbox.Text) <= 31 Then
'---------------
End If
He isn't getting ANY msgbox error, there is some code elsewhere that is throwing that particular error, and it was program generated as well. Search for it, or paste the whole program and someone else will
It is okay for now guys, thanks for the help! But I have a problem, when I type the number '1' on the textbox, it reaction the first number on the value of the trackbar2 but when I type '1.0' on the textbox which the trackbar2 value should reaction 1001 but it stay on the first value of the trackbar!!!!!!!!
How can I get this to solve??
Thanks,
Mark
Is this what you are saying - If the textbox has 1 in it then the trackbar.value should be 1, if it has 1.0 the trackbar.value should be 1001?Quote:
Originally Posted by mark103
Does 1 = 1.0?
Yes that is what I am trying to do, and no 1 is not 1.0. I only want the textbox with 1 that trackbar.value should be 1 and I want to show 1.0 on the textbox which the trackbar.value should be 1001.
I tried this
Code:If Val(Form2.Textbox.Text) = "1.0" Then
Form2.Trackbar.Value = "1001"
End If
If Val(Form2.Textbox.Text) = "1" Then
Form2.Trackbar.Value = "1"
It didn't work. It shows '1' as value on 1001 on trackbar. It should be on value 1. Hope you can help.
Thanks,
Mark
Quote:
Originally Posted by Oblio
Hint -> Does the Val function return a string? How does VB treat a number in quote marks?
Hint 2 -> Tutorial
You should have this as line #1 of any code your write
Option Strict On
And BTW -
Code:If 1 = 1.0 Then
Debug.WriteLine("They are equal")
End If
Thanks, but have a problem again. When I type 1.0 on the textbox, the value on trackbar didn't move to 1000. Do you know why the value didn't move to when I type on the textbox 1.0??
Code:If 1 = 1 Then
Form2.TrackBar2.Value = 1
End If
If 1.0 = 1000 Then
Form2.TrackBar2.Value = 1000
End If
Hope you can help to get it resolve.
Thanks,
Mark
Mark,
I think it is about time for you to purchase a beginners programming book. You need to understand about variables and objects and such. Look at your If statements.
"If 1 = 1"
This statement will always be true. 1 will always = 1.
"If 1.0 = 1000"
This will never be true. 1.0 will never equal 1000.
What you need to do is compare the values in your text box object.
May I suggest...
Code:SELECT CASE Form2.Textbox.Text
Case "1"
Form2.TrackBar2.Value = 1
Case "1.0"
Form2.TrackBar2.Value = 1000
Case Else
MsgBox "Please enter 1 or 1.0 in the textbox"
End Select
:ehh: OMG
I give up. Please read the tutorial at least.
This post has seriously made my day. You should become a part time comedian!Quote:
Originally Posted by mark103
If you are being serious however, invest in a VB.NET book or some book that explains about variables. Or better yet, quit wasting people's time and pursue a career in comedy - You'd be fantastic.
guys, there is no need to suggestions me to go and buy a VB.Net book. I have been with vb for 3 years which I feel good to learn myself so please be nice, help and friendly :)
Apart from that, I still have trouble with the method. I created a new module, I typed and created the code correctly and get things working around better but if I put Testbox.ShowDialog() on my module and if I type any numbers like let say "666", the trackbar value should move to 666 but I have received Testbox.Showdialog. How I can stop that??
Code:If Val(Form2.Textbox.Text) <= 1000 Then
Form2.TrackBar2.Value = Val(Form2.Textbox.Text)
End If
If Val(Form2.Textbox.Text) = "1000" Then
Form2.TrackBar2.Value = 1000
End If
If Val(Form2.Textbox.Text) >= "1000" Then
Testbox.Showdialog()
End If
I am not over the limit as the maximum number would allows me to type up to 1000. I don't really understand where they are coming from.
Hope you guys can advise with this troubleshoot.
Thanks,
Mark
If you call this 3 years of VB, you should give up. You cannot compare a STRING to a NUMBER, and when you say "1000" that is NOT the same as 1000.
"1000" is a STRING
1000 is a NUMBER
VAL("1000") turns it INTO a NUMBER (if it was one)
VAL("X") = 0 (because "X" is not a number)
it just has to be a joke. 666, come on. smile we are on candid forum, right. no one is this bad.
BOB5731 had an excuse. Don't know what happened to him...
http://www.vbforums.com/showthread.p...hlight=bob5%2A