Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42277

Hi Fellas, My name is Sarah and I am having trouble with a project using the MID func

$
0
0
Hello Fellas, have been at this for the longest and I am not sure whats wrong.
I am using Visual basics 2010 and I am trying to use the MID function with the following code.


Dim homesaverStorage1 As String = Mid(Textbox2.Text, 1, 255)
Dim homesaverStorage2 As String = Mid(Textbox2.Text, 255, 255)
Dim homesaverStorage3 As String = Mid(Textbox2.Text, 511, 255)
Dim homesaverstorage4 As String = Mid(Textbox2.Text, 767, 255)
Dim homesaverstorage5 As String = Mid(Textbox2.Text, 1023, 255)


Homesaver1.Text = homesaverStorage1
homesaver2.Text = homesaverStorage2
homesaver3.Text = homesaverStorage3
homesaver4.Text = homesaverstorage4
homesaver5.Text = homesaverstorage5


so basically I have textbox2 and I am trying to break up whats in textbox2 into 5 boxes. Each box can hold only 255 characters. So far so good. Ok here is my problem, in homesaver3.text I am missing a character, and the same with homesaver4.text . Lets say for instance I have a group of numbers in these boxes:

"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234"
So lets say the 255th character stoped at 2 , it will display in one box

output in the boxes
Homesaver2.text will show 1234 1234 1234 1
homesaver3.text will show 34 1234

its suppose to be like this

1234 1234 1234 1
234 1234

it keeps eating up a character if the word is cut off in one box and needs to continue in another box.

I want to thank you guys in advance for your time. :)

Using the mid function for some reason makes me lose one character, would someone out thier be able to tell me why or how do I fix this, or should I not even use the mid function at all :(

Viewing all articles
Browse latest Browse all 42277

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>