Page 1 of 1
offsets to textbox
Posted: Sun Jul 22, 2007 4:17 am
by spikes122
hey
im using vb 06
i was wondering how i could write a offsets value (convert to asci first)
into a text box in vb.
Posted: Sun Jul 22, 2007 8:57 am
by OwnZ joO
well you can say
Code: Select all
txtOffsetTextBox.Text = offset.ToString() if you want it in decimal if I remember right
txtOffsetTextBox.Text = offset.ToString("X") if you want it in hex I think
Posted: Sun Jul 22, 2007 10:02 am
by Prey
I understand vb06 differs from 2005.. but I'm unsure if that would be correct OwnZ, heres what would work in 2005
Code: Select all
txtOffsetTextBox.Text = offset 'Display the integer as is
txtOffsetTextBox.Text = Hex(offset) 'Display the base 16 conversion of the integer
Edit* After re-reading your post it seems you want the value from the current position of the reader in the stream, again 2005 code here (also assuming you initialized your reader and it is at the correct position)
Code: Select all
txtOffsetTextBox.Text = reader.ReadInt32() 'Will read the integer at the current position in the current stream
Posted: Sun Jul 22, 2007 10:46 am
by spikes122
hmmm so ok so say if i had the offsets
11111111 = o
and 22222222=k
in vb 06
how would i put that into one box
im not very gd at vb memory
thanks
Posted: Sun Jul 22, 2007 11:56 am
by OwnZ joO
spikes122 wrote:hmmm so ok so say if i had the offsets
11111111 = o
and 22222222=k
in vb 06
how would i put that into one box
im not very gd at vb memory
thanks
I'm pretty sure you have it backwards
you meant:
right?
well it would be:
Code: Select all
txtOffsetTextBox.Text = o.ToString()
Posted: Sun Jul 22, 2007 12:21 pm
by spikes122
hmmmm ok
thanks
so ok if my offset was 1111111 and value was a
so where would i put the offset and the value of a in this line of code
txtOffsetTextBox.Text = o.ToString()
thanks
Posted: Sun Jul 22, 2007 12:44 pm
by OwnZ joO
if your variable name(value) is a then it would be a.ToString() instead of o.ToString()
Posted: Sun Jul 22, 2007 12:55 pm
by spikes122
well what i mean is in halos memory theres offsets for a players name
so thse offsets have a value like 87
so i want to convert 87 to asci then into textbox
so say if the value 87=s
then my textbox would display s
thanks if i can get it to work ill give u credit
Posted: Sun Jul 22, 2007 1:47 pm
by OwnZ joO
ok to give a variable a value you need to put the value on the right side of the equal sign.
So you need to make it s = 87 not 87 = s
then you need to do this
textbox.Text = s.ToString()
this code would be for displaying 87 in the textbox, not the value at offset 87, you would need to have a binaryreader for that
Posted: Sun Jul 22, 2007 4:00 pm
by Prey
VB handles the conversions, thus you don't need to have the .ToString()'s and thus you won't have to convert the value once read,
Code: Select all
dim Value as Integer = 'Read the value here
TextBox1.Text = Value
Simple as that, also Spike if you could learn to grasp the English language a little better it would be most appreciated; it is quite tiresome to read dribble.
Posted: Mon Jul 23, 2007 1:56 am
by spikes122
im still not really sure
so my ffset for the first letter of the players name is 1111111 so the offset has a value of 87 but i want to convert it text into the textbox
dim Value as Integer = 'Read the value here
TextBox1.Text = Value
so in that would i juust write the offset after integer part
its just i cant write the value myself because it changes for each server i make so it needs to get the players name offset and convert to text into the textbox so i can see every players names
and lol its because i was typing fast
Posted: Mon Jul 23, 2007 2:28 am
by Prey
Post the code that you use to open up the map in a reader and seek to your specific '111..' offset.
Posted: Mon Jul 23, 2007 11:00 am
by spikes122
would it be easyier to do this in c++ or C?
Posted: Tue Jul 24, 2007 12:03 am
by spikes122
ok thanks for your help ive managed to get it to read the value into a textbox
however its not text asci
its just -193
how would i convert it to teh asci string view
thanks
Posted: Sun Jul 29, 2007 8:52 pm
by OwnZ joO
BinaryReader.ReadChar() returns a char
You can make a new String out of a char or chars
so:
Code: Select all
Dim br As BinaryReader = new BinaryReader(new FileStream(file))
Dim c As char = br.ReadChar()
Dim s As String = new String(c)
That's how I would do it in C# converted to vb, Not sure if it works exactly like that in VB
You could try just sending the char into the textbox.Text, maybe vb converts it for you.