1.11M Members

Vb.net Help plz :(

 
0
 

Ok i have made a picture ;)
That will explain it a lil better.

I just need to add that certain code ***|*** to textbox2.text
but * can be 1 2 3 4 5 6 7 8 9

button2_click: if textbox1.text.contains("***|***")
then ...

Picture:
http://imageshack.us/photo/my-images/43/naamlooses.jpg/

 
0
 

May be you only understand what are you trying to do.

 
0
 

See if this helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With TextBox1
            .Text = "123|456" '// FOR TESTING.
            For Each c As Char In .Text '// loop thru all char.s.
                If Char.IsDigit(c) Then .Text = .Text.Replace(c, "*") '// .Replace char. with your char..
            Next
        End With
    End Sub
 
0
 

No Doesnt work :(

 
0
 

Works here just fine.
Try explaining the issue and not just saying sh.t don't work.

Just wondering, is it changing all #'s in the entire TextBox and you only need to change the #'s on the lines that .Contains("|")?
AndAlso, change only the first 3 #'s before the "|" and the 3 #'s after?

Hope this helps to solve your issue, although it should have been info provided by you already.

p.s. Welcome to an "IT" forum.:)

 
0
 

See if this helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With TextBox1
            .Text = "123|456" '// FOR TESTING.
            For Each c As Char In .Text '// loop thru all char.s.
                If Char.IsDigit(c) Then .Text = .Text.Replace(c, "*") '// .Replace char. with your char..
            Next
        End With
    End Sub

it changes whole the code in textbox1.text to ***|***
but i need something that's finds in textbox1.text this ***|***
for example ***|*** can be
458|145
463|852
it can be anything with numbers and when it finds the values it must go in textbox2.text
now i tried to do this:

if textbox1.text.contains("145|458") then
textbox2.text = textbox1.text.replace("145|458","..."

but 145|458 is only if it is in textbox1.text but i need a random code for it cuz the ***|*** can be between 100|100 - 999|999

Question Answered as of 2 Years Ago by codeorder, debasisdas and kingsonprisonic
 
0
 

Found it:


Dim ary1() As String
ary1 = TextBox1.Text.Split("|")
Label1.Text = ary1(0)
Label2.Text = ary1(1)

Dim aString As String = Label1.Text
Dim bString As String = Label2.Text

aString = Strings.Right(aString, 3)
bString = Strings.Left(bString, 3)

TextBox2.Text = TextBox2.Text & aString & "|" & bString

 
1
 

I just finished putting this together. Hope it helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        replaceText(TextBox1)
    End Sub

    Private Sub replaceText(ByVal myCoolTextBoxToReplaceIn As TextBox)
        Dim iSi As Integer, sTemp As String
        With myCoolTextBoxToReplaceIn
            Do Until iSi >= .TextLength
                If .Text.Substring(iSi).Contains("|") Then
                    iSi = .Text.IndexOf("|", iSi)
                    sTemp = .Text.Substring(iSi - 3, 7)
                    .Text = .Text.Replace(sTemp, "***|***")
                    MsgBox(sTemp) '// get value.
                End If
                iSi += 1
            Loop
        End With
    End Sub
 
0
 

I just finished putting this together. Hope it helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        replaceText(TextBox1)
    End Sub

    Private Sub replaceText(ByVal myCoolTextBoxToReplaceIn As TextBox)
        Dim iSi As Integer, sTemp As String
        With myCoolTextBoxToReplaceIn
            Do Until iSi >= .TextLength
                If .Text.Substring(iSi).Contains("|") Then
                    iSi = .Text.IndexOf("|", iSi)
                    sTemp = .Text.Substring(iSi - 3, 7)
                    .Text = .Text.Replace(sTemp, "***|***")
                    MsgBox(sTemp) '// get value.
                End If
                iSi += 1
            Loop
        End With
    End Sub

Thank You So Much ;D
This is working 100% <3

 
0
 

Glad I could help. :)

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: