Re: Passing text boxes between forms

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"David Bland" <DavidBland@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8A41E603-AD52-48D8-BFCA-9953358EB8D6@xxxxxxxxxxxxxxxx
> Hi
>
> I am trying to write a search text routine, but I was hoping to do it from
> one form to another i.e a Find (crtl F) type form. I have a text box on
> one
> form (Main) and another form (Search) with a text box to enter the test
> and a
> find button. When I click the find button I want it to take the text
> entered
> on the Search form and search the text on the Main form. I currently get
> the
> follwoing message Object variable or With block variable not set, can some
> one help or is there a control that will do this for me ?

Step one. Document which line is throwing the error. Everybody know what
the Find dialog does.

>
> Main Form
>
> Private Sub Command1_Click()
>
> Dim ourSearch As SearchForm
> Set ourSearch = New SearchForm
>
> ourSearch.TextBoxIn = txtECPAPI
> ourSearch.Show
>
> Set ourSearch = Nothing
> End Sub
>
> Search Form
> Private mstrTextBox As Textbox
>
> Public Property Get TextBoxIn() As Textbox
> TextBoxIn = mstrTextBox
> End Property
>
> Public Property Let TextBoxIn(ByVal TextBoxVal As Textbox)
> mstrTextBox = TextBoxVal
> End Property
>
> Private Sub cmdFindNext_Click()
>
> Dim lngPos As Long
> Dim lngTemp As Long
> Dim strFind As String
>
> strFind = txtSearchString
>
> lngPos = 1
>
> lngPos = InStr(lngPos, TextBoxIn.Text, strFind, vbTextCompare)
> lngTemp = lngPos
>
> If lngPos > 0 Then
> HighlightText TextBoxIn, strFind, lngTemp
> lngStrPos = lngPos + Len(strFind)
> End If


.



Relevant Pages

  • Re: Passing text boxes between forms
    ... Public Property Get TextBoxIn() As Textbox ... Public Property Let TextBoxIn ... : Dim lngPos As Long ... : Dim strFind As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Passing text boxes between forms
    ... >: Dim ourSearch As SearchForm ... Public Property Get TextBoxIn() As Textbox ... Public Property Let TextBoxIn ... >: Dim strFind As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Passing text boxes between forms
    ... >> Dim ourSearch As SearchForm ... >> Public Property Get TextBoxIn() As Textbox ... >> Public Property Let TextBoxIn ... >> Dim strFind As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Spell Checker
    ... I have a textbox, that he user can type some information. ... Private m_sTextCorrected As String ... Public Property Get TextCorrectedAs String ... you must add a reference to the Word object library. ...
    (microsoft.public.vb.controls)
  • User control combining TextBox and RadioButtonList
    ... All works fine, but the TextBox, on the PostBack Event, doesn't ... Public Class RadioButtonListOther: Inherits RadioButtonList ... Public Property OtherMessage() As String ... Protected Overrides Sub Render ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)