VB.NET

Moderators: seancampbell
Number of threads: 4020
Number of posts: 10026

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Database search Posted by Bill H on 19 Sept 2004 at 10:02 AM
This message was edited by Bill H at 2004-9-19 14:16:20

This message was edited by Bill H at 2004-9-19 14:1:8

I am using Access 2000 and VB.Net. I have several tables, each of which I show on a datagrid in a different form, and that form only. What I want to do is a "search" and "sort" on each one of the tables when that form is on the screen by way of user input. I have created a "search" form with a textbox which I open on top of the current form. What I need to know is the code, (and where to put it), to take the input of the textbox on the search form and put the results in the datagrid on the bottom form. In other words.....I want this to work the same as the "find" function in an MS Works database where the "find" function brings up a window with a textbox for user input and then resets the datagrid to show only that information requested, and closes the "find" window. I also want to be able to do the same thing with a "sort" window. This doesn't seem like too big a task when the code and all are on the same form but I can't find any information on doing this from one form to another. Any help would be greatly appreciated. I can adapt the code from the first table to all the rest.
Thanx in advance !!!!!
Bill

To Kainsworth:
Thanx a million for your help. I must be doing something wrong however as I added a textbox to my datagrid data form to try this and even though there doesn't seem to be anything wrong with the code, it does not update the text in the main form. I have the friends set up in a module and put the textbox code under an OK button on my search form. I don't know the term "Modally", I am bringing up my search form with:
dim objfrmsearch as new frmsearch
objfrmsearch.show
I also tried it both ways you had indicated. Perhaps I have the code for something in the wrong location. By the way, I used the wizard to set up my connection and datagrid which work fine.
Bill H


Report
Re: Database search Posted by kainsworth on 19 Sept 2004 at 11:27 AM
Hi Bill
If I've understood your problem correctly, it sounds like the problem is one of Scope. You want to take some user input from a textbox on your search form, close the search form, then use that input on one of the forms which contains a DataGrid.

To do this, you need to be able to reference either the controls on various forms from other forms and/or be able to reference the ADO objects - datasets, datatables, or dataviews, etc - on other forms.

Here's a fairly primitive way of achieving this.
In a module, create a variable to hold each of the forms you want to deal with.
Friend Module Module1
    Friend f1 As Form1
    Friend f2 As Form2
    Friend fs As frmSearch
End Module

In the form_load event of each of the forms, add code similar to this:
'  In Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        f1 = Me
End Sub

Obviously substituting the relevant variable for each form.

I'm assuming that you will open your search form modally? This avoids the need to check that only one instance of it is running.
This code will do that for you:
 fs = New frmSearch
 fs.ShowDialog()

But if you need to control this aspect and don't want a modal form, you can use code like this:
 If fs Is Nothing Then
    fs = New FrmSearch
    fs.Show()
 End If


Now you have References to all the forms in the project, and from those references you also have access to all their controls, variables and procedures.
To avoid this reply becoming endless with ADO code, I've just included one simple example of how you can read data that was input into a textbox on a search form and display it in a messagebox on another form.
' In Form2
 If Not fs Is Nothing Then
     Me.TextBox1.Text = (fs.TextBox1.Text)
 End If

The above code effectively transfers the contents of a textbox on the Search Form into a textbox on Form2. (In case you are wondering, this does work, even though you have closed the search form)
Obviously, there are lots of ways you can expand on this very basic example, including the use of the input text to search your database. ( I always use a DataView for this, as it makes it just so easy, but that's just my personal preference.)

If you need to go into more depth with multiple forms handling, you might want to check out one or more of the Multiple Forms articles on this site:
www.devcity.net
In particular, this article : http://www.devcity.net/net/article.aspx?alias=multipleforms2
might be of interest to you. There are some others in the series, but I that one is probably the most relevant.

I hope the above is of help.

Ged

=================================================================




: I am using Access 2000 and VB.Net. I have several tables, each of which I show on a datagrid in a different form, and that form only. What I want to do is a "search" and "sort" on each one of the tables when that form is on the screen by way of user input. I have created a "search" form with a textbox which I open on top of the current form. What I need to know is the code, (and where to put it), to take the input of the textbox on the search form and put the results in the datagrid on the bottom form. In other words.....I want this to work the same as the "find" function in an MS Works database where the "find" function brings up a window with a textbox for user input and then resets the datagrid to show only that information requested, and closes the "find" window. I also want to be able to do the same thing with a "sort" window. This doesn't seem like too big a task when the code and all are on the same form but I can't find any information on doing this from one form to another. Any help would be greatly appreciated. I can adapt the code from the first table to all the rest.
: Thanx in advance !!!!!
: Bill
:

Report
Re: Database search Posted by kainsworth on 20 Sept 2004 at 12:48 AM
Hi Bill,
Re: I guess we both forgot we assigned f1 to Form1 in the module !!
It's probably my fault for not making it clear enough in my reply.
fs is the variable which contains a reference to the search form, not form2. I thought this would be a more realistic example for you, as you would be wanting to take the user input from a search form, not from another 'general' form.
Anyhow, you got it working, and that's the main thing.


A Modal form is one of those (sometimes annoying) forms which has to be closed before the user can continue with the application. The built in message box is a good example of something which is displayed modally. For some reason the syntax was changed from VB.Classic to VB.Net, so now in order to display a form modally, you have to use the
 FormVariableName.ShowDialog 
syntax.
In the context of your project, it could be a useful tool to ensure the user enters the data needed for a search before you allow them to continue.


Here's the kind of code I use for a simple search and display in a DataGrid. You will see that I use a DataView (called dvAddresses). This is a very useful Data Object which is particularly handy in situations like this.
The DataView comes complete with its own RowFilter (ie. a tool to select items which meet your criteria).
' Clear Filter  ready for new search
 f1.dvAddresses.RowFilter = ""  
' Apply new filter to the DataView
f1.dvAddresses.RowFilter = "LastName = '" & txtSearchPhrase.Text & "'"
'  Ensure that your DatagGrid has this DV as its DataSource '  Set the 
 f1.DataGrid1.DataSource = dvAddresses

You'll probably have spotted the subtle difference in the above code logic from my previous example. In the one above, the Datagrid on the underlying form is repopulated while the search form is still open. This isn't strictly necessary, but can be useful .
You can also change the search parameter so that it enumerates through more than one column, and you can give the user a choice of columns to search (eg. Search by last name, by city, etc).
And of course it is possible, though rather more complex, to search through all fields of your data and produce new sets of data that meet multiple search criteria.
I hope the above gives you a head start on a basic search technique.

For more info on the DataView object, there is some very clear first steps guidance from Mike McIntyre in a set of articles, commencing in the October 30th 2003 devCity Newsletter. http://www.devcity.net/newsletter/archive/devcity/devcity20031030.htm#ni030
It's a four part article, and well worthy of study. You can see the newsletter archive list here if you want to track down all four articles:
http://www.devcity.net/net/newsletters.aspx

Ged
======================================================================

There is also a beginners example in this issue of the Newsletter
http://www.devcity.net/newsletter/archive/devcity/devcity20040414.htm#ni070 which is continued in the next issue. ASlthough it uses XML for data storage, the logic is very similar.



: Hi Bill
: If I've understood your problem correctly, it sounds like the problem is one of Scope. You want to take some user input from a textbox on your search form, close the search form, then use that input on one of the forms which contains a DataGrid.
:
: To do this, you need to be able to reference either the controls on various forms from other forms and/or be able to reference the ADO objects - datasets, datatables, or dataviews, etc - on other forms.
:
: Here's a fairly primitive way of achieving this.
: In a module, create a variable to hold each of the forms you want to deal with.
:
: Friend Module Module1
:     Friend f1 As Form1
:     Friend f2 As Form2
:     Friend fs As frmSearch
: End Module
: 

: In the form_load event of each of the forms, add code similar to this:
:
'  In Form1
: Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
:         f1 = Me
: End Sub
: 

: Obviously substituting the relevant variable for each form.
:
: I'm assuming that you will open your search form modally? This avoids the need to check that only one instance of it is running.
: This code will do that for you:
:
:  fs = New frmSearch
:  fs.ShowDialog()
: 

: But if you need to control this aspect and don't want a modal form, you can use code like this:
:
:  If fs Is Nothing Then
:     fs = New FrmSearch
:     fs.Show()
:  End If
: 

:
: Now you have References to all the forms in the project, and from those references you also have access to all their controls, variables and procedures.
: To avoid this reply becoming endless with ADO code, I've just included one simple example of how you can read data that was input into a textbox on a search form and display it in a messagebox on another form.
:
: ' In Form2
:  If Not fs Is Nothing Then
:      Me.TextBox1.Text = (fs.TextBox1.Text)
:  End If
: 

: The above code effectively transfers the contents of a textbox on the Search Form into a textbox on Form2. (In case you are wondering, this does work, even though you have closed the search form)
: Obviously, there are lots of ways you can expand on this very basic example, including the use of the input text to search your database. ( I always use a DataView for this, as it makes it just so easy, but that's just my personal preference.)
:
: If you need to go into more depth with multiple forms handling, you might want to check out one or more of the Multiple Forms articles on this site:
: www.devcity.net
: In particular, this article : http://www.devcity.net/net/article.aspx?alias=multipleforms2
: might be of interest to you. There are some others in the series, but I that one is probably the most relevant.
:
: I hope the above is of help.
:
: Ged
:
: =================================================================
:
:
:
:
: : I am using Access 2000 and VB.Net. I have several tables, each of which I show on a datagrid in a different form, and that form only. What I want to do is a "search" and "sort" on each one of the tables when that form is on the screen by way of user input. I have created a "search" form with a textbox which I open on top of the current form. What I need to know is the code, (and where to put it), to take the input of the textbox on the search form and put the results in the datagrid on the bottom form. In other words.....I want this to work the same as the "find" function in an MS Works database where the "find" function brings up a window with a textbox for user input and then resets the datagrid to show only that information requested, and closes the "find" window. I also want to be able to do the same thing with a "sort" window. This doesn't seem like too big a task when the code and all are on the same form but I can't find any information on doing this from one form to another. Any help would be greatly appreciated. I can adapt the code from the first table to all the rest.
: : Thanx in advance !!!!!
: : Bill
: :
:
:

Report
Re: Database search Posted by Bill H on 21 Sept 2004 at 4:12 PM
: Hi Bill,
: Re: I guess we both forgot we assigned f1 to Form1 in the module !!
: It's probably my fault for not making it clear enough in my reply.
: fs is the variable which contains a reference to the search form, not form2. I thought this would be a more realistic example for you, as you would be wanting to take the user input from a search form, not from another 'general' form.
: Anyhow, you got it working, and that's the main thing.
:

: A Modal form is one of those (sometimes annoying) forms which has to be closed before the user can continue with the application. The built in message box is a good example of something which is displayed modally. For some reason the syntax was changed from VB.Classic to VB.Net, so now in order to display a form modally, you have to use the
 FormVariableName.ShowDialog 
syntax.
: In the context of your project, it could be a useful tool to ensure the user enters the data needed for a search before you allow them to continue.
:

: Here's the kind of code I use for a simple search and display in a DataGrid. You will see that I use a DataView (called dvAddresses). This is a very useful Data Object which is particularly handy in situations like this.
: The DataView comes complete with its own RowFilter (ie. a tool to select items which meet your criteria).
:
: ' Clear Filter  ready for new search
:  f1.dvAddresses.RowFilter = ""  
: ' Apply new filter to the DataView
: f1.dvAddresses.RowFilter = "LastName = '" & txtSearchPhrase.Text & "'"
: '  Ensure that your DatagGrid has this DV as its DataSource '  Set the 
:  f1.DataGrid1.DataSource = dvAddresses
: 

: You'll probably have spotted the subtle difference in the above code logic from my previous example. In the one above, the Datagrid on the underlying form is repopulated while the search form is still open. This isn't strictly necessary, but can be useful .
: You can also change the search parameter so that it enumerates through more than one column, and you can give the user a choice of columns to search (eg. Search by last name, by city, etc).
: And of course it is possible, though rather more complex, to search through all fields of your data and produce new sets of data that meet multiple search criteria.
: I hope the above gives you a head start on a basic search technique.
:
: For more info on the DataView object, there is some very clear first steps guidance from Mike McIntyre in a set of articles, commencing in the October 30th 2003 devCity Newsletter. http://www.devcity.net/newsletter/archive/devcity/devcity20031030.htm#ni030
: It's a four part article, and well worthy of study. You can see the newsletter archive list here if you want to track down all four articles:
: http://www.devcity.net/net/newsletters.aspx
:
: Ged
: ======================================================================
:
: There is also a beginners example in this issue of the Newsletter
: http://www.devcity.net/newsletter/archive/devcity/devcity20040414.htm#ni070 which is continued in the next issue. ASlthough it uses XML for data storage, the logic is very similar.
:
:
:
: : Hi Bill
: : If I've understood your problem correctly, it sounds like the problem is one of Scope. You want to take some user input from a textbox on your search form, close the search form, then use that input on one of the forms which contains a DataGrid.
: :
: : To do this, you need to be able to reference either the controls on various forms from other forms and/or be able to reference the ADO objects - datasets, datatables, or dataviews, etc - on other forms.
: :
: : Here's a fairly primitive way of achieving this.
: : In a module, create a variable to hold each of the forms you want to deal with.
: :
: : Friend Module Module1
: :     Friend f1 As Form1
: :     Friend f2 As Form2
: :     Friend fs As frmSearch
: : End Module
: : 

: : In the form_load event of each of the forms, add code similar to this:
: :
'  In Form1
: : Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
: :         f1 = Me
: : End Sub
: : 

: : Obviously substituting the relevant variable for each form.
: :
: : I'm assuming that you will open your search form modally? This avoids the need to check that only one instance of it is running.
: : This code will do that for you:
: :
: :  fs = New frmSearch
: :  fs.ShowDialog()
: : 

: : But if you need to control this aspect and don't want a modal form, you can use code like this:
: :
: :  If fs Is Nothing Then
: :     fs = New FrmSearch
: :     fs.Show()
: :  End If
: : 

: :
: : Now you have References to all the forms in the project, and from those references you also have access to all their controls, variables and procedures.
: : To avoid this reply becoming endless with ADO code, I've just included one simple example of how you can read data that was input into a textbox on a search form and display it in a messagebox on another form.
: :
: : ' In Form2
: :  If Not fs Is Nothing Then
: :      Me.TextBox1.Text = (fs.TextBox1.Text)
: :  End If
: : 

: : The above code effectively transfers the contents of a textbox on the Search Form into a textbox on Form2. (In case you are wondering, this does work, even though you have closed the search form)
: : Obviously, there are lots of ways you can expand on this very basic example, including the use of the input text to search your database. ( I always use a DataView for this, as it makes it just so easy, but that's just my personal preference.)
: :
: : If you need to go into more depth with multiple forms handling, you might want to check out one or more of the Multiple Forms articles on this site:
: : www.devcity.net
: : In particular, this article : http://www.devcity.net/net/article.aspx?alias=multipleforms2
: : might be of interest to you. There are some others in the series, but I that one is probably the most relevant.
: :
: : I hope the above is of help.
: :
: : Ged
: :
: : =================================================================
: :
: :
: :
: :
: : : I am using Access 2000 and VB.Net. I have several tables, each of which I show on a datagrid in a different form, and that form only. What I want to do is a "search" and "sort" on each one of the tables when that form is on the screen by way of user input. I have created a "search" form with a textbox which I open on top of the current form. What I need to know is the code, (and where to put it), to take the input of the textbox on the search form and put the results in the datagrid on the bottom form. In other words.....I want this to work the same as the "find" function in an MS Works database where the "find" function brings up a window with a textbox for user input and then resets the datagrid to show only that information requested, and closes the "find" window. I also want to be able to do the same thing with a "sort" window. This doesn't seem like too big a task when the code and all are on the same form but I can't find any information on doing this from one form to another. Any help would be greatly appreciated. I can adapt the code from the first table to all the rest.
: : : Thanx in advance !!!!!
: : : Bill
: : :
: :
: :
:
:
Hi Ged
I'm trying to use your suggestion with the dataview to display the textbox input which I have left as textbox1 and a dataview named "dvgentest" and this line tells me that "dvgentest" is not declared:
f1.grdgentest.DataSource = dvgentest
I'm not sure where to declare it and the syntax. Also, I used:
f1.dvgentest.RowFilter = textbox1
will that work since I want to be able to pull up any records that match the textbox input in any field of the table ?
Thanx...Bill
Report
Re: Database search Posted by Bill H on 21 Sept 2004 at 7:31 PM
: : Hi Bill,
: : Re: I guess we both forgot we assigned f1 to Form1 in the module !!
: : It's probably my fault for not making it clear enough in my reply.
: : fs is the variable which contains a reference to the search form, not form2. I thought this would be a more realistic example for you, as you would be wanting to take the user input from a search form, not from another 'general' form.
: : Anyhow, you got it working, and that's the main thing.
: :

: : A Modal form is one of those (sometimes annoying) forms which has to be closed before the user can continue with the application. The built in message box is a good example of something which is displayed modally. For some reason the syntax was changed from VB.Classic to VB.Net, so now in order to display a form modally, you have to use the
 FormVariableName.ShowDialog 
syntax.
: : In the context of your project, it could be a useful tool to ensure the user enters the data needed for a search before you allow them to continue.
: :

: : Here's the kind of code I use for a simple search and display in a DataGrid. You will see that I use a DataView (called dvAddresses). This is a very useful Data Object which is particularly handy in situations like this.
: : The DataView comes complete with its own RowFilter (ie. a tool to select items which meet your criteria).
: :
: : ' Clear Filter  ready for new search
: :  f1.dvAddresses.RowFilter = ""  
: : ' Apply new filter to the DataView
: : f1.dvAddresses.RowFilter = "LastName = '" & txtSearchPhrase.Text & "'"
: : '  Ensure that your DatagGrid has this DV as its DataSource '  Set the 
: :  f1.DataGrid1.DataSource = dvAddresses
: : 

: : You'll probably have spotted the subtle difference in the above code logic from my previous example. In the one above, the Datagrid on the underlying form is repopulated while the search form is still open. This isn't strictly necessary, but can be useful .
: : You can also change the search parameter so that it enumerates through more than one column, and you can give the user a choice of columns to search (eg. Search by last name, by city, etc).
: : And of course it is possible, though rather more complex, to search through all fields of your data and produce new sets of data that meet multiple search criteria.
: : I hope the above gives you a head start on a basic search technique.
: :
: : For more info on the DataView object, there is some very clear first steps guidance from Mike McIntyre in a set of articles, commencing in the October 30th 2003 devCity Newsletter. http://www.devcity.net/newsletter/archive/devcity/devcity20031030.htm#ni030
: : It's a four part article, and well worthy of study. You can see the newsletter archive list here if you want to track down all four articles:
: : http://www.devcity.net/net/newsletters.aspx
: :
: : Ged
: : ======================================================================
: :
: : There is also a beginners example in this issue of the Newsletter
: : http://www.devcity.net/newsletter/archive/devcity/devcity20040414.htm#ni070 which is continued in the next issue. ASlthough it uses XML for data storage, the logic is very similar.
: :
: :
: :
: : : Hi Bill
: : : If I've understood your problem correctly, it sounds like the problem is one of Scope. You want to take some user input from a textbox on your search form, close the search form, then use that input on one of the forms which contains a DataGrid.
: : :
: : : To do this, you need to be able to reference either the controls on various forms from other forms and/or be able to reference the ADO objects - datasets, datatables, or dataviews, etc - on other forms.
: : :
: : : Here's a fairly primitive way of achieving this.
: : : In a module, create a variable to hold each of the forms you want to deal with.
: : :
: : : Friend Module Module1
: : :     Friend f1 As Form1
: : :     Friend f2 As Form2
: : :     Friend fs As frmSearch
: : : End Module
: : : 

: : : In the form_load event of each of the forms, add code similar to this:
: : :
'  In Form1
: : : Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
: : :         f1 = Me
: : : End Sub
: : : 

: : : Obviously substituting the relevant variable for each form.
: : :
: : : I'm assuming that you will open your search form modally? This avoids the need to check that only one instance of it is running.
: : : This code will do that for you:
: : :
: : :  fs = New frmSearch
: : :  fs.ShowDialog()
: : : 

: : : But if you need to control this aspect and don't want a modal form, you can use code like this:
: : :
: : :  If fs Is Nothing Then
: : :     fs = New FrmSearch
: : :     fs.Show()
: : :  End If
: : : 

: : :
: : : Now you have References to all the forms in the project, and from those references you also have access to all their controls, variables and procedures.
: : : To avoid this reply becoming endless with ADO code, I've just included one simple example of how you can read data that was input into a textbox on a search form and display it in a messagebox on another form.
: : :
: : : ' In Form2
: : :  If Not fs Is Nothing Then
: : :      Me.TextBox1.Text = (fs.TextBox1.Text)
: : :  End If
: : : 

: : : The above code effectively transfers the contents of a textbox on the Search Form into a textbox on Form2. (In case you are wondering, this does work, even though you have closed the search form)
: : : Obviously, there are lots of ways you can expand on this very basic example, including the use of the input text to search your database. ( I always use a DataView for this, as it makes it just so easy, but that's just my personal preference.)
: : :
: : : If you need to go into more depth with multiple forms handling, you might want to check out one or more of the Multiple Forms articles on this site:
: : : www.devcity.net
: : : In particular, this article : http://www.devcity.net/net/article.aspx?alias=multipleforms2
: : : might be of interest to you. There are some others in the series, but I that one is probably the most relevant.
: : :
: : : I hope the above is of help.
: : :
: : : Ged
: : :
: : : =================================================================
: : :
: : :
: : :
: : :
: : : : I am using Access 2000 and VB.Net. I have several tables, each of which I show on a datagrid in a different form, and that form only. What I want to do is a "search" and "sort" on each one of the tables when that form is on the screen by way of user input. I have created a "search" form with a textbox which I open on top of the current form. What I need to know is the code, (and where to put it), to take the input of the textbox on the search form and put the results in the datagrid on the bottom form. In other words.....I want this to work the same as the "find" function in an MS Works database where the "find" function brings up a window with a textbox for user input and then resets the datagrid to show only that information requested, and closes the "find" window. I also want to be able to do the same thing with a "sort" window. This doesn't seem like too big a task when the code and all are on the same form but I can't find any information on doing this from one form to another. Any help would be greatly appreciated. I can adapt the code from the first table to all the rest.
: : : : Thanx in advance !!!!!
: : : : Bill
: : : :
: : :
: : :
: :
: :
: Hi Ged
: I'm trying to use your suggestion with the dataview to display the textbox input which I have left as textbox1 and a dataview named "dvgentest" and this line tells me that "dvgentest" is not declared:
: f1.grdgentest.DataSource = dvgentest
: I'm not sure where to declare it and the syntax. Also, I used:
: f1.dvgentest.RowFilter = textbox1
: will that work since I want to be able to pull up any records that match the textbox input in any field of the table ?
: Thanx...Bill
:
I'm sorry to keep bugging you....unfortunately I spent a lot of time with VB 5.0 and am having a very hard time with this new syntax.
I did however figure out the above....I should have added f1 to:
f1.grdgentest.DataSource = (f1)dvgentest
It works perfectly with that resolved, however, as I said, I want to be able to have the user put any field from any record in the textbox in the search form and bring up all the records for that parameter. You mentioned in a previous reply that this could be done but I am going crazy trying to figure out the syntax to replace the statement after "f1.dvgentest.RowFilter =". Perhaps you could get me started with a couple fields and I can figure out the rest.....my fields are as follows:
Band, Breed, Club, Color, Fed, Period, Racer, Sex, Strain, from a table called "gentest".
Thanx Bill
Report
Re: Database search Posted by Bill H on 19 Sept 2004 at 5:21 PM
: This message was edited by Bill H at 2004-9-19 14:16:20

: This message was edited by Bill H at 2004-9-19 14:1:8

: I am using Access 2000 and VB.Net. I have several tables, each of which I show on a datagrid in a different form, and that form only. What I want to do is a "search" and "sort" on each one of the tables when that form is on the screen by way of user input. I have created a "search" form with a textbox which I open on top of the current form. What I need to know is the code, (and where to put it), to take the input of the textbox on the search form and put the results in the datagrid on the bottom form. In other words.....I want this to work the same as the "find" function in an MS Works database where the "find" function brings up a window with a textbox for user input and then resets the datagrid to show only that information requested, and closes the "find" window. I also want to be able to do the same thing with a "sort" window. This doesn't seem like too big a task when the code and all are on the same form but I can't find any information on doing this from one form to another. Any help would be greatly appreciated. I can adapt the code from the first table to all the rest.
: Thanx in advance !!!!!
: Bill
:
: To Kainsworth:
: Thanx a million for your help. I must be doing something wrong however as I added a textbox to my datagrid data form to try this and even though there doesn't seem to be anything wrong with the code, it does not update the text in the main form. I have the friends set up in a module and put the textbox code under an OK button on my search form. I don't know the term "Modally", I am bringing up my search form with:
: dim objfrmsearch as new frmsearch
: objfrmsearch.show
: I also tried it both ways you had indicated. Perhaps I have the code for something in the wrong location. By the way, I used the wizard to set up my connection and datagrid which work fine.
: Bill H
:
:
:
Hey Ged.....I figured out what was wrong !!
In the code you gave me for Form 2 as follows:
If Not fs Is Nothing Then
Me.TextBox1.Text = (fs.Textbox1.Text)
I guess we both forgot we assigned f1 to Form1 in the module !!
Simply changed Me to f1 and it works perfectly !! Sure appreciate the help !! Now all I have to do is figure out the proper Select syntax to put the results of the search textbox into my datagrid. I want to be able to Select any record(s) from the Table, clear the datagrid, and post the results to the datagrid. Any suggestions on code for that would not be unappreciated.
Thanx again.....Bill



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.