Results 1 to 15 of 15

Thread: One form Multiple uses.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2011
    Posts
    139

    One form Multiple uses.

    Hi,
    How would i go about creating a "Search Feature". I have all of the algortihiums to do this, but at the moment it's hassle for me to have both forms, and 3 seperate buttons for searching. I think its more complicated than it needs to be.

    I was thinking about creating a label at the top of form and using the following:
    "If label1.text = "" then
    ......
    End if"

    But how would i get it to get the value of the text box from a seperate form, and make form perform a seperate feature, if you see what i mean.

    Thanks

  2. #2
    Lively Member
    Join Date
    Dec 2010
    Posts
    89

    Re: One form Multiple uses.

    If it works, why brake it?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2011
    Posts
    139

    Re: One form Multiple uses.

    The reason is, because my final solution has 9 forms, which are all very similar.
    Why have 3 forms for searching, when i could have 1
    See what i mean ?

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: One form Multiple uses.

    Post a screenshot of one of your search forms and show us which controls are being redundant on the other 2 search forms. Without seeing the actual form, it's really hard for anyone to give you any suggestions.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  5. #5
    Lively Member
    Join Date
    Dec 2010
    Posts
    89

    Re: One form Multiple uses.

    So you want the Search to search text in the textbox?
    Unfortunately the way I know only works on RichTextBoxes, and it's
    Code:
    RichTextBox1.Find
    .

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jan 2011
    Posts
    139

    Re: One form Multiple uses.

    Thanks Stanav. I'll get my VERY slow laptop to open the application, and show you.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jan 2011
    Posts
    139

    Re: One form Multiple uses.

    Quote Originally Posted by VOT Productions View Post
    So you want the Search to search text in the textbox?
    Unfortunately the way I know only works on RichTextBoxes, and it's
    Code:
    RichTextBox1.Find
    .
    No - Ill post the algorithum up in a minute, you will see what i mean.


    Edit: it might be a little while, as I will have to logon to the college network and get the updated version from there. Sorry :L

  8. #8
    Lively Member
    Join Date
    Dec 2010
    Posts
    89

    Re: One form Multiple uses.

    OK, and it's algorithm not algorithum.

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jan 2011
    Posts
    139

    Re: One form Multiple uses.

    Quote Originally Posted by VOT Productions View Post
    OK, and it's algorithm not algorithum.
    - you can tell im a VERY sloppy person

  10. #10
    Lively Member
    Join Date
    Dec 2010
    Posts
    89

    Re: One form Multiple uses.

    Take as long as you want, but not 1 week.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jan 2011
    Posts
    139

    Re: One form Multiple uses.

    Quote Originally Posted by VOT Productions View Post
    Take as long as you want, but not 1 week.
    Sorry for the delay, I forgot to make a backup of the project onto my memory stick! :@... and you know what its like living in the middle of the countryside!.

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jan 2011
    Posts
    139

    Re: One form Multiple uses.

    Code:
     Private SubBtnCustomerSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCustomerSearch.Click
            
    FileInitCustomer()
            Dim tempCustomer2 As CustomerInfo = Nothing
            Dim blnFound As Boolean = False
            'the search terms are padded out to match the saved string format
            Dim strFirstNameF As String = String.Format("{0,-20}", txtSearchFirstName.Text)
            Dim strLastNameF As String = String.Format("{0,-20}", txtSearxhLastName.Text)
            Dim intfilenum3 As Int16 = FreeFile()
            FileOpen(intfilenum3, strCustomerFileName, OpenMode.Random, OpenAccess.ReadWrite, , intCustomerRecLen)
            Dim intRec As Int16 = 0
    
    
            Do Until intRec = intCustomerNumRecs Or blnFound
                'read next rec
                intRec = intRec + 1
                FileGet(intfilenum3, tempCustomer2, intRec)
                'if name matches
                If tempCustomer2.strFirstName = strFirstNameF And tempCustomer2.strLastname = strLastNameF Then
                    blnFound = True
                    RecFound = intRec
                End If
            Loop
            FileClose(intfilenum3)
            If blnFound Then
                GetRecCustomer(RecFound)
                DisplayRecCustomer()
            Else
                MsgBox("Customer Not Found")
            End If
    
        End Sub

  13. #13
    Lively Member
    Join Date
    Dec 2010
    Posts
    89

    Re: One form Multiple uses.

    Well a piece of advice is have a up to date version on every PC.

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Jan 2011
    Posts
    139

    Re: One form Multiple uses.

    Quote Originally Posted by VOT Productions View Post
    Well a piece of advice is have a up to date version on every PC.
    I've Learn't my lesson from this

  15. #15
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: One form Multiple uses.

    Just some comments on your code:
    1. Get rid of those VB6 legacy methods (FileOpen, FileGet, FileClose...) and use standard .Net methods.
    2. Use a database to store your data instead of a flat text file. If you use a database, you may not need to use any of those FileOPen, FileGet... method at all. However, it also introduces you to ADO.Net which may take a little while to get familiar with.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width