|
-
Jan 24th, 2011, 01:18 PM
#1
Thread Starter
Addicted Member
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
-
Jan 24th, 2011, 01:22 PM
#2
Lively Member
Re: One form Multiple uses.
If it works, why brake it?
-
Jan 24th, 2011, 01:25 PM
#3
Thread Starter
Addicted Member
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 ?
-
Jan 24th, 2011, 01:29 PM
#4
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 -
-
Jan 24th, 2011, 01:30 PM
#5
Lively Member
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 .
-
Jan 24th, 2011, 01:31 PM
#6
Thread Starter
Addicted Member
Re: One form Multiple uses.
Thanks Stanav. I'll get my VERY slow laptop to open the application, and show you.
-
Jan 24th, 2011, 01:32 PM
#7
Thread Starter
Addicted Member
Re: One form Multiple uses.
 Originally Posted by VOT Productions
So you want the Search to search text in the textbox?
Unfortunately the way I know only works on RichTextBoxes, and it's .
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
-
Jan 24th, 2011, 01:34 PM
#8
Lively Member
Re: One form Multiple uses.
OK, and it's algorithm not algorithum.
-
Jan 24th, 2011, 01:36 PM
#9
Thread Starter
Addicted Member
Re: One form Multiple uses.
 Originally Posted by VOT Productions
OK, and it's algorithm not algorithum.
- you can tell im a VERY sloppy person
-
Jan 24th, 2011, 01:38 PM
#10
Lively Member
Re: One form Multiple uses.
Take as long as you want, but not 1 week.
-
Jan 24th, 2011, 01:42 PM
#11
Thread Starter
Addicted Member
Re: One form Multiple uses.
 Originally Posted by VOT Productions
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!.
-
Jan 24th, 2011, 01:43 PM
#12
Thread Starter
Addicted Member
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
-
Jan 24th, 2011, 01:44 PM
#13
Lively Member
Re: One form Multiple uses.
Well a piece of advice is have a up to date version on every PC.
-
Jan 24th, 2011, 01:55 PM
#14
Thread Starter
Addicted Member
Re: One form Multiple uses.
 Originally Posted by VOT Productions
Well a piece of advice is have a up to date version on every PC.
I've Learn't my lesson from this
-
Jan 24th, 2011, 02:10 PM
#15
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|