5 Replies - 1144 Views - Last Post: 13 November 2011 - 02:25 PM Rate Topic: -----

#1 cmzerres  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-November 11

How can I read a certain line of a string in VB.NET?

Posted 13 November 2011 - 01:58 PM

Hi. How do I read a certain line of a string?
Here is my current code:
        TextBox2.Text = SuperVB.ReadFile(OpenFileDialog1.FileName)
        Dim lineFirst As String = TextBox1.Text.Line(1)
        MsgBox(lineFirst)


Please help me.
I don't want to read a file's line.
Is This A Good Question/Topic? 0
  • +

Replies To: How can I read a certain line of a string in VB.NET?

#2 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1362
  • View blog
  • Posts: 3,002
  • Joined: 30-January 11

Re: How can I read a certain line of a string in VB.NET?

Posted 13 November 2011 - 02:09 PM

In your code above isn't it supposed to be -

Dim lineFirst As String = TextBox2.Text.Line(1)


We really need a bit more information than that though. Are you trying to read a specific line in a textbox? In which case you just use the .Lines property which is a string array -

Dim line as String = textbox1.Lines[1];

Was This Post Helpful? 0
  • +
  • -

#3 cmzerres  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-November 11

Re: How can I read a certain line of a string in VB.NET?

Posted 13 November 2011 - 02:13 PM

View PostRyano121, on 13 November 2011 - 02:09 PM, said:

In your code above isn't it supposed to be -

Dim lineFirst As String = TextBox2.Text.Line(1)


We really need a bit more information than that though. Are you trying to read a specific line in a textbox? In which case you just use the .Lines property which is a string array -

Dim line as String = textbox1.Lines[1];

Thank you!!!!
If I like an answer, is there anything I should do?
I'm new to Dream.In.Code

View Postcmzerres, on 13 November 2011 - 02:10 PM, said:

View PostRyano121, on 13 November 2011 - 02:09 PM, said:

In your code above isn't it supposed to be -

Dim lineFirst As String = TextBox2.Text.Line(1)


We really need a bit more information than that though. Are you trying to read a specific line in a textbox? In which case you just use the .Lines property which is a string array -

Dim line as String = textbox1.Lines[1];

Thank you!!!!
If I like an answer, is there anything I should do?
I'm new to Dream.In.Code

IDENTIFIER EXPECTED
Was This Post Helpful? 0
  • +
  • -

#4 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1362
  • View blog
  • Posts: 3,002
  • Joined: 30-January 11

Re: How can I read a certain line of a string in VB.NET?

Posted 13 November 2011 - 02:13 PM

If you found an answer helpful, click the green '+' icon on the button on the bottom right hand corner of the post :)

This post has been edited by Ryano121: 13 November 2011 - 02:14 PM

Was This Post Helpful? 0
  • +
  • -

#5 cmzerres  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-November 11

Re: How can I read a certain line of a string in VB.NET?

Posted 13 November 2011 - 02:15 PM

View PostRyano121, on 13 November 2011 - 02:13 PM, said:

If you found an answer helpful, click the green '+' icon on the button on the bottom right hand corner of the post :)

Requires Identifier
I will click if you tell me wuzzup with that error.
Was This Post Helpful? 0
  • +
  • -

#6 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1362
  • View blog
  • Posts: 3,002
  • Joined: 30-January 11

Re: How can I read a certain line of a string in VB.NET?

Posted 13 November 2011 - 02:25 PM

I haven't seen that before. All you need to do is press the green button next to the 'Was this post helpful?' text. It doesn't even load a new page. Log out and back in? Restart browser?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1