Integer always change to hex!

Sabour

Active member
Joined
Sep 1, 2006
Messages
25
Programming Experience
Beginner
i have one form that read user input it will assign to a public variable, here is the code
VB.NET:
ElseIf IsNumeric(txt1.Text) = True And IsNumeric(txt2.Text) = True And IsNumeric(txt3.Text) = True Then
                        Main.text1 = CInt(txt1.Text)
                        Main.text1 = CInt(txt2.Text)
                        Main.text1 = CInt(txt3.Text)
                        Main.Access = 1
                        Main.Custom = 1
                        Me.Close()
                        Main.Show()
                    End If
i have set the variable as this :
VB.NET:
    Public text1 As Integer
    Public text2 As Integer
    Public text3 As Integer
the problem is when iam call at a function
VB.NET:
test = (ascode * Main.text1)
test = (ascode / Main.text2)
test = (ascode - Main.text3)
the integer which set in "text1,text2,text3" changed into hex? while i need it in integer ;(

here is the value when called in that function
VB.NET:
Main.text1 = &H28
Main.text2 = &H5
Main.text3 = &H3C
i even have tried convert it back to integer
VB.NET:
test = (ascode * cint(Main.text1))
test = (ascode / cint(Main.text2))
test = (ascode - cint(Main.text3))
same always got hex? code

also trying this
VB.NET:
ElseIf IsNumeric(txt1.Text) = True And IsNumeric(txt2.Text) = True And IsNumeric(txt3.Text) = True Then
                        Main.text1 = CInt(txt1.Text.ToString)
                        Main.text1 = CInt(txt2.Text.ToString)
                        Main.text1 = CInt(txt3.Text.ToString)
                        Main.Access = 1
                        Main.Custom = 1
                        Me.Close()
                        Main.Show()



End If

how to fix this?? any help appreciated , thx for reading this question :)
 
that looks like the memory address of the integer variable than hex

try showing the value of the integer in a messagebox to see if it's actually holding the correct value (integers cant hold hex values anyways)

MessageBox.Show(Main.Text1.ToString)
 
that looks like the memory address of the integer variable than hex

try showing the value of the integer in a messagebox to see if it's actually holding the correct value (integers cant hold hex values anyways)

MessageBox.Show(Main.Text1.ToString)
ya same exact value as i set from other from, but the problem is
when iam doing at this calculation always got hex value

VB.NET:
test = (ascode * Main.text1)
test = (ascode / Main.text2)
test = (ascode - Main.text3)
same like this

VB.NET:
test = (ascode * cint(Main.text1))
test = (ascode / cint(Main.text2))
test = (ascode - cint(Main.text3))
if i set to double the value crossed but somehow the vb always ignore the arithmetic operator "*","-","/"

i mean,

VB.NET:
test = 40
test = (ascode * Double.Parse(Main.text1))
test = (ascode / Double.Parse(Main.text2))
test = (ascode - Double.Parse(Main.text3))
test = test 'at here test value exactly same 40 like untouched
'the arithmetic operator :(
 
What about
VB.NET:
 test = cint(ascode * Main.text1)
Also, in your first block of code, you have set main.text1 three times! Hope it was a type-o on here and not in your code lol
 
I dont understand. Why would you do this:

Main.text1 = CInt(txt3.Text.ToString)

you get a textbox, take the text out, convert it to a number, then have VB implicitly convert it back to text when you set the Main.text1 property?

Why not just do this:
Main.text1 = txt3.Text
 
Sabour.. i have your code and have opened the project. I cannot find the code you mentioned in this post, but I've found this:

Else If Main.CustomModifier = 1 Then
Dim Mod1 As Integer = CInt(Main.Mod1)
Dim Mod2 As Integer = CInt(Main.Mod1)
Dim Mod3 As Integer = CInt(Main.Mod1)


If you can get back to me to tell me if I'm looking in the right place, and what I should do with the program to cause execution to reach this point then I'll take a look at what is happening...
 
Back
Top