VB6 had a span method, how do you do this in vb.net

Discussion in 'Microsoft VB .NET' started by Guest, Jun 10, 2005.

  1. Guest

    Guest Guest

    In vb6 you could find text then span to include all text to a given point.


    Public Sub Findd(RTF As RichTextBox, Find As String)

    RTF.Find (Find)
    textfind = RTF.Find(Find)
    If textfind <> -1 Then
    foundtxt = True
    RTF.Span "@", True, True
    RTF.SetFocus
    Exit Sub
    Else
    foundtxt = False
    Exit Sub
    End If

    End Sub


    How do you do this or somthing like it in VB.net?
     
    Guest, Jun 10, 2005
    #1
    1. Advertisements

  2. Guest

    rawCoder Guest

    from
    http://www.dotnet4all.com/Dot-Net-Books/2004/09/richtextbox-span-method.html
    You have to get the ITextDocument of the richtextbox and call the
    Selection.Expand(tomWord) method ,see the msdn docs for ItextDocument
    interface.

    HTH
    rawCoder

    "Servoris" <> wrote in message
    news:...
    > In vb6 you could find text then span to include all text to a given point.
    >
    >
    > Public Sub Findd(RTF As RichTextBox, Find As String)
    >
    > RTF.Find (Find)
    > textfind = RTF.Find(Find)
    > If textfind <> -1 Then
    > foundtxt = True
    > RTF.Span "@", True, True
    > RTF.SetFocus
    > Exit Sub
    > Else
    > foundtxt = False
    > Exit Sub
    > End If
    >
    > End Sub
    >
    >
    > How do you do this or somthing like it in VB.net?
     
    rawCoder, Jun 10, 2005
    #2
  3. Guest

    Guest Guest

    Thanks for the responce. I have seen this before and I have not been able to
    find more info. I am not a pro. programmer, just a hobbyist. I need to see
    examples to understand.

    "rawCoder" wrote:

    > from
    > http://www.dotnet4all.com/Dot-Net-Books/2004/09/richtextbox-span-method.html
    > You have to get the ITextDocument of the richtextbox and call the
    > Selection.Expand(tomWord) method ,see the msdn docs for ItextDocument
    > interface.
    >
    > HTH
    > rawCoder
    >
    > "Servoris" <> wrote in message
    > news:...
    > > In vb6 you could find text then span to include all text to a given point.
    > >
    > >
    > > Public Sub Findd(RTF As RichTextBox, Find As String)
    > >
    > > RTF.Find (Find)
    > > textfind = RTF.Find(Find)
    > > If textfind <> -1 Then
    > > foundtxt = True
    > > RTF.Span "@", True, True
    > > RTF.SetFocus
    > > Exit Sub
    > > Else
    > > foundtxt = False
    > > Exit Sub
    > > End If
    > >
    > > End Sub
    > >
    > >
    > > How do you do this or somthing like it in VB.net?

    >
    >
    >
     
    Guest, Jun 10, 2005
    #3

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SamSpade

    RichTextBox Span method

    SamSpade, Apr 23, 2004, in forum: Microsoft VB .NET
    Replies:
    2
    Views:
    646
    SamSpade
    Apr 27, 2004
  2. johnb41

    Life span of VB6?

    johnb41, Jan 4, 2005, in forum: Microsoft VB .NET
    Replies:
    16
    Views:
    608
    johnb41
    Jan 7, 2005
  3. Douglas Marquardt

    ComInterop: VB6 Com Interface object = VB6 Com object fails

    Douglas Marquardt, Mar 22, 2006, in forum: Microsoft VB .NET
    Replies:
    1
    Views:
    508
    Douglas Marquardt
    Mar 22, 2006
  4. Ruth
    Replies:
    3
    Views:
    438
    Herfried K. Wagner [MVP]
    Aug 18, 2006
  5. SAL
    Replies:
    3
    Views:
    6,015
    Cor Ligthert[MVP]
    Dec 19, 2007
Loading...

Share This Page