Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Visual Basic





See Related Forum Messages: Follow the Links Below to View Complete Thread

Combo In Datagrid(button Property Of Datagrid)
Hi,
We are working on datagrid and want to know how the button property
of the datagrid used. We have been working on this and are stuck as
to how to use each cell of the grid as combo box.

Datagrid Search
I am trying to create a search function which looks through a datagrid and displays all matching values in the datagrid. The initial search value is taken from a text box in the form.

i am new to vb and dont know where to start with this function...anyone have any ideas to help me get started?

Search In Datagrid
Hi all


I've got datagrid (name=podaciGrid) with data in it from database, a Textbox (name=Text1) and Combobox (name=Combo1).

What I wana do is that when user write first letters if record in textbox a value, to show in datagrid only records that are in column (Combobox.value)

For instance:

If user writes letter "D", all records in column (Combobox.value) that begins with letter "D" are shown. If user writes letter "R", The value that is searched is now "DR", all records in column (Combobox.value) that begins with letter "DR" are shown. etc.....

Hope you understud my problem.

So far I've got folowing code (don't know if it is good)



Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)

Me.podaciGrid.ClearFields

Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset

Set MyConn = New ADODB.Connection

MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsDejanDesktoppekaraPodacipekara.mdb;"
MyConn.CursorLocation = adUseClient
MyConn.Open

Set MyRecSet = MyConn.Execute("SELECT * FROM Kupci WHERE '" & Combo1.Text & "' LIKE " & TextBox1.Text & "*" & "")

Me.podaciGrid = MyRecSet.Fields(Combo1.Text).Value
MyConn.Close

End Sub


THNX

Search In Datagrid Using ADO
hello, how to search specific record in ADO using datagrid.

Datagrid Search
Hi All,

I have a datagrid on my form and would like to be able to search the records in the grid. Currently I am able to do this using a text box and a command button with an SQL LIKE.

The problem is it clears the datagrid and fills it again with the results of the search. This is OK, but what I would really like to do is;

1) Find the first record and move down the grid to the first matching searched field.
2) Be able to click a button and go to the next record matching the search.
3) Display the current matching record in the grid after each keypress in the search text box. If I type an L, then it goes to the first record that starts with an L or has an L in a word in that field. After every keypress, it builds a new search string.

This is my search method

Code:
Private Sub Command4_Click()
Dim drwnametxt As String
drwnametxt = Text1.Text

strSQL = "Select drwName,Rev,CrDt,ModDt,LastRefDt,Descr,Cust,Commnts,Note,Grain,GrainAng,Matl," & _
"UsrDefd2,UsrDefd3,UsrDefd4,UsrDefd5,UsrDefd6 from " & drwINIValue & "drwFiles.dbf" & Chr$(32) & "Where drwName LIKE '%" & drwnametxt & "%'"


Debug.Print strSQL
'Debug.Print drwnametxt
'DataGrid1.ClearFields
rsDrwFile.Open strSQL, dbConn, adOpenKeyset, adLockOptimistic
Set DataGrid1.DataSource = rsDrwFile
Set rsDrwFile = Nothing
End Sub


This is how I load my grid

Code:
DataGrid1.ClearFields
strSQL = "Select drwName as Drawing,Rev,CrDt,ModDt,LastRefDt,Descr,Cust,Commnts,Note,Grain,GrainAng,Matl," & _
"UsrDefd2,UsrDefd3,UsrDefd4,UsrDefd5,UsrDefd6 from " & drwINIValue & "EngFiles.dbf" '& Chr$(32) & "Order by" & Chr$(32) & srtParam
rsDrwFile.Open strSQL, dbConn, adOpenKeyset, adLockOptimistic

Set DataGrid1.DataSource = rsDrwFile
Set rsDrwFile = Nothing


As allways, I appreciate everyone's help.

Datagrid Search Help
When i type an ID thats not in my database it gives me an error when i type one that is in the database it then shows that record but when i type in another Id in thats not in the database it then shows the message box saying its not in the database.


VB Code:
Private Sub cmdSearch_Click()   Dim lngPos As Long    lngPos = MWB.AbsolutePosition    MWB.MoveFirst    MWB.Find "Id = '" & txtSearch.Text & "'"     If MWB.EOF Then        MWB.AbsolutePosition = lngPos        MsgBox "id does not exist"    Else        MsgBox "id found"        cmdUpdate.Enabled = True        cmdNew.Enabled = False        cmdCancel.Visible = True    End If    Call txtEnabled End Sub

Search Datagrid
hi..i have a form where as soon as it loads, records stored in the database are displayed in the datagrid..i wanna be able to add a search text box where users can search for specific records, like first name..how do i do so? my datagrid is connected to an adodc control..thanks in advance.

How To Search The DataGrid?
I have a combobox which contains: Items, Suppliers, Customers and All

Those three pertains to my three datagrids. Now what I want to do is when a user chooses either of the four, types whatever he/she wants to look for (for example "Green Button") and finally presses the "Go" button, the datagrid will only display the row where the word "Green Button" is located. If, for example there are 2 or more rows which contains the word "Green Button," pressing "Go" will only display those two rows.

I have used MS Access for my database and calling forth the datagrid is hard-coded (I'm no longer using an ADODC control).

I attached the image of my form to make my point clearer. Thanks!

(Attachment removed)

Search Datagrid
hi..i have a form where as soon as it loads, records stored in the database are displayed in the datagrid..i wanna be able to add a search text box where users can search for specific records, like first name..how do i do so? my datagrid is connected to an adodc control..thanks in advance.

How Can I Search Within A DataGrid
Anyway, im writing a program which displays records from a database table. DataGrid has 4 columns, and approx 35000 individual lines of information, hence i need to create a search function so that the user can be taken directly to the line of information requested by the search.
Column 1 is the column i wish to search as it will contain individual part codes. the rest of the columns are there simply for related information.
Im not using an ADO control, so far ive connected to the database by adding a Data Environment... If an ADO control is required please let me know.
Ive tried everything, i need code to make this work
Im using MS Visual Basic Ver.6

Any help with this is much appreciated!

Thanks

Search In Datagrid
Hi,
   Got a problem..i have a set of data from MS Access connected to Datagrid and i want search by entering some character. I have 2 columns and i want to a search button for each, can someone please tell me how to do this..

***included a .EXE file***        

Search Datagrid
hi..i have a form where as soon as it loads, records stored in the database are displayed in the datagrid..i wanna be able to add a search text box where users can search for specific records, like first name..how do i do so? my datagrid is connected to an adodc control..thanks in advance.

Datagrid Search
hi i'm new to this...i have a datagrid connected to an adodc..the recorsource of the adodc is cmdtable..i want to add a search box and command button that enables me to search n display the result in the datagrid..my database is named cims and the table is student_registration..i wanna be able to search for First_Name..how do i do so? thanks.

Datagrid - Search
Hi,

I need a datagrid search function. like i have a datagrid with 10 rows and 5 cols. in my search textbox i type some keyword and click find button. suppose the search result will return 5 rows mean i can highlight the 5 rows. till now no problem.

i need to show one by one.. like here the problem is i have a find next button. so when i click findnext it should highlight the first row and again i click find next it should highlight the next search word row. like notpad find next functionality.

Using recordset i fill up the datagrid.

is it possible? anyone have a sample code?

Thanks
Bala

Combo Box Search
Havnt been able to find anything on this one although I know it exists. I have a combo and when a user types in text I was it to find the closest match. Anyone have any links or anything to this? I appreciate any help.

Combo Box Search Help
aaa...sry abt this msg...duno how to delete message...i found the solution...

Search Using A Combo Box
My task with combobox is:
When I Type a letter in combobox it should select the Item which is starting
with the letter.
for example the Combobox items are One,two,three,Four,Five,thirty,forty,fifty etc.
When I type 't',it should select "three" which is first in combobox items and the focus on remaining "hree".again when i type 'h'(becomes"th") and the focus on "ree",on typing 'i'(becomes"thi"),combo should select "thirty",and focus on "rty".like that it should go on.

Combo Box Search
I am a VB 6 developer. I have some combo boxes with huge lists. By setting the 'style' property the users can search through the list, but only according to one (the first character of the string)

Is there a way to use the text portion of the combo box as a key to search through the list alphabetically for as many characters as the user may enter? Is there some sample code to do this or is this basic VB functionality that i'm ignorant of.

Thanks,

Tom

Combo Box Search
I have a combo box on my form which is populated from a DB and has over a 1000 records.

I want to enhance my vb form so that when the user begins to type into the combo box the selection becomes automatically highlighted.

Can someone show me how ?

How To Do A Search Using A Combo Box ?
I need help..i'm currently creating a disciplinary system for my campus. I have a problem in searching for paricular from a database..i need to know the coding
for it..

for example i have a combo box and i wanna search and display but differnt categories..for eg. search bu NRIC search by Offences search by Classes and stc...

I need your guidance can any1 pls show me how to do it..

Search In Combo
I have a problem.

I have developed a form consisting of a combo box. The data is populated into the combo from access database. The combo list may contain a few thousand entries. At run time the user wants to select item from the combo. As the combo box has thousands of entries, it is cumbersome to scroll and get the record. What I need is:
 Can I fetch any record by entering a first character so that it directs to the list item starting with the character. Is there any option or source code to do so.

Thanks

Combo Search With RDO
Hi )

Does anybody know how to search for a record with interactivity when using a ComboBox and RDO programming.

Thanks ;-)

Duke1000 :-)

Sort & Search DataGrid
I need to make a search in a datagrid using a textbox but sorting the search by column using a combobox. For instance, I choose part number in combobox, then type part number to search for in textbox. I can make one or the other work but can't get the two to work together.

Search Text In DataGrid
How do I go about searching for text in a DataGrid?

I tried the following:

rs.Find DataGrid.Columns(1) = strInputBox


Thanks in advance for the help.

Search Results In Datagrid
Im busy making a mok till/stock system for a project and am trying to show a search for a barcode in a database and showing the results on a database grid. heres my code:

blurb about searching for barcode....
if .nomatch then
show a message...
else
dbgTranPending.Columns(0).text = DatStock.Recordset.Fields("Barcode")
dbgTranPending.Columns(1).text = DatStock.Recordset.Fields("Name")
dbgTranPending.Columns(2).text = DatStock.Recordset.Fields("Price")
end if

This works fine for the first search but the next one just over-writes the first. Is there a way to change which row its showing the search data on or something?

Thanks
Rockerby

Datagrid Search Issue
Hi,
I have an application built in vb6 sp6 that uses sqlexpress. This application is running on 3 different continents on hundreds of machines. In the last few months i have been getting support calls saying that people cannot do a advanced search on the datagrid in the application. Usually by typing in the first few letters of a word, the grid takes them to any word that matches those letters, now it will only work for the first letter i type in. By the randomness of this and the fact the software version is the same for all machines that this issue have been caused by a windows update.
Any advice would be apprecaited.
Thanks,
Ray

Datagrid Search & Scroll
Hi all,

I have populated a DataGrid using the following method:

--------------------------------------------------------------------------
Sub PopulateDGrid()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sql As String

Set con = GetConnection

sql = "SELECT p.firstnames,p.surname FROM people p ORDER BY p.surname;"

Set rs = con.Execute(sql)

Set DataGrid1.DataSource = rs

Set con = Nothing
Set rs = Nothing

End Sub
--------------------------------------------------------------------------
1. I need code 2 go to a specific record, once I click the search button, i want to go to that record on the datagrid based on what i enter in the textbox.
2. I also need to display information for each pupil in textboxes. Once i scroll the datagrid that information must change accordingly.

Please help.

Search Datagrid Error
Ok, this search feature use to work but now it doesnt. The error it shows me it this in order.



The error line it in the code is:


VB Code:
Adodc1.Refresh


This is the whole code for the search:


VB Code:
'The follwing event triggers when the user peforms SearchPrivate Sub cmdSearch_Click()     Dim qstr As String      'Declare a temperory query string            qstr = GetCriteria()    'Initialize query strin by calling function GetCriteria        If qstr <> "" Then      'If user has specifed some criteria for searching            Adodc1.CommandType = adCmdText  'Treat qstr as SQL Query String        Adodc1.RecordSource = qstr      'Bind query string to ActiveX Data Object        Adodc1.Refresh                  'Refresh records by executing query                'Text1.Text = Adodc1.Recordset.Fields(0)        Set DataGrid1.DataSource = Adodc1.Recordset     'Bind Data Grid to new Recordset        DataGrid1.Refresh               'Refresh data grid against new records        End If End Sub


Does anyone know whats wrong with it.

Thanx in advance.

Text Search On Datagrid
How can I use my textbox to search on my data???
for example If i type a character data grid will select the nearest match on my field.Just like in Access.

thanks!.

Search Result In Datagrid
i want to create a search form that will show the search result in datagrid when a data is typed in a text box and search button is clicked..
i know its easy but i cant ..as i m new with vb but familiar with sql commands.

heres a part of the code

Private Sub searchitem_Click()
Dim qstring As String
qstring = "select * from items where id = '" + Text1.Text + "'"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:myVBshopshop.mdb;Persist Security Info=False"
Adodc1.RecordSource = qstring
End Sub

Search Values In Datagrid
i have used following query and store result in datagrid

Code:query="select InvNo as [Invoice Number], Invdt as [Invoice Date], Namt as [Net Amount]" it populates result with column names of datagrid as it should
i.e.

Invoice Number
Invoice Date
Net Amount

Now , i want to search withing datagrid , so for that m using following sytax

Code:Dim s As String, Sheader As String * 20
' s=INputbox$("Enter Value search for " & dglist.Columns(0).
            Sheader = "[" & dgList.Columns(dgList.Col).DataField & "]"
            s = InputBox("Enter value search for " & Sheader, "Search " & s, dgList.Columns(dgList.Col).Text)
            
            If s <> "" Then
                rs.Find (Sheader & "=" & s)
                
            End If

as i have used Invoice Number as column header
rs.find will take
rs.find ("invoice Number" = & number) it should rs.find("invNo" & = & number)

and it's firing error
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.


how to out from such error ????

It May seem Impossible, But Possibly We don't know the way how to reach there ????

Search Result In Datagrid
i want to create a search form that will show the search result in datagrid when a data is typed in a text box and search button is clicked..
i know its easy but i cant ..as i m new with vb but familiar with sql commands.

heres a part of the code

Private Sub searchitem_Click()
Dim qstring As String
qstring = "select * from items where id = '" + Text1.Text + "'"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:myVBshopshop.mdb;Persist Security Info=False"
Adodc1.RecordSource = qstring
End Sub

:help:

Highlight Row Of DataGrid In A Search
Hi,
I'm Searching the recordset and highlighting the found record in a DataGrid using the SelBookmarks Collection. I get error: Run-Time error:3001 Arguments are of wrong type, are in conflict, or are out of acceptable range for this line:

VehicleEdRevised.Adodc1.Recordset.Find " " & strList & "& = & '" & strFind & "' "

In debugger, everything seems to have the proper values...The only thing that I can think of that might affect this is that I set the adodc1 recordset command type to adCmdText and wrote my select statement directly into the Command Text(SQL) box....Does anyone have any ideas for me?? Or any other ways I could write a search?

Thanks! Sonia


Private Sub cmdSearch_Click()
Dim strFind As String
Dim strList As String

strFind = txtUserInput.Text
strList = cboList.Text

VehicleEdRevised.Adodc1.Recordset.Find " " & strList & "& = & '" & strFind & "' "

If VehicleEdRevised.Adodc1.Recordset.EOF Then
MsgBox "No records found.", vbExclamation
Else:
VehicleEdRevised.DataGrid1.SelBookmarks.Add VehicleEdRevised.DataGrid1.Bookmark
End If

End Sub

Combo Box Auto Search
I got a combo box and it is linked to a table full of employee's details. what i need it to do is when i scroll the list and find the employee and click on it, display the information about him within the form.

Newbie question, but i am a newbie tbh

Any help is most welcome

Search Database With Combo Box Value
Could someone tell me what is the best way to search an access97 database for values in a combo box.
I want the values in the combo box to load from the data base, as in a list of company names, but the user can type in a new name and if it doesn't exist then update the data base when they are saving the record.
Can that be done? or do you have to do two seperate actions?

Thanks.

Smart Combo Search
I've got a comboBox filled with some values (sorted). Now this is what i am looking for: When you type a letter in the combobox I want it to jump to the first value that matches that letter (I want to use this for a search form).
I assume that there is an smart and existing method for this, but I just didn't know how to search for it. Any help is appreciated.

Farpoint Combo Box Search
Hey All

Anyone out there use Far points ComboboxADO?
if so would you know how to set up the combobox so that you can search a particular.

I have tried using the properties (Multiple Char, Partial Match etc) but cannot get it to search properly on the second col. (seems to always search the first)

hope some one can help.

Ta
Zubie

Search Through Combo Box And Grid
Hi

i want when when i select table field from combo and against this i put some text in text box..and pon press search button the searched record should be in the grid

i also attched the files .
plz help me

Thanx for help in advance

Combo Auto Search
with combo1
.additem "One"
.additem "Two"
.additem "Three"
end with

when i type "T" in combo box, the word "Three will be display and the "hree" is highlited?

how can i do that?

Combo List Search.
I have a combo box that has a list of integer values. Is there a quick way to find if a certain value exists in the combo box list?

Thanks.

Combo Box Search And Destroy...
How do i search a combo box for a STRING and if its found destroy(erase) the string and add the new one. BASICALLy how do i replace a string in a combo box with another the exact same one ?

Database Search With Combo Box
my program currently has a combo box which lists all the fields in my database. What I would like to do is selcect one of the feilds from the combo box and then type in data i want found into a text box. I would then like a flexi grid to display all the records with the data i typed in the text box.

Please, please help me. I would very much appriecate it and would be forever in your debt.

Database Search With Combo Box
my program currently has a combo box which lists all the fields in my database. What I would like to do is selcect one of the feilds from the combo box and then type in data i want found into a text box. I would then like a flexi grid to display all the records with the data i typed in the text box.

Please, please help me. I would very much appriecate it and would be forever in your debt.



Report this post to a moderator

Incremental Search In A Combo Box
Has anyone seen or made a combo box with incremental Search? I found one on MS page http://support.microsoft.com/kb/154076, but it is slow. If you type too fast, it will just skip to the end of the current selection in the text. I need something a bit better than that.

I also found one at http://www.mckisicsoftware.com/Reso...ic_faqs.htm#q_9 which looked promising, but I couldn't quite get it to work.

Any ideas?

Database Combo Box Search
In my current project I have a form with an ADO object linked to an Access 2000 database (using the properties). The form also contains three combo boxes and a few text boxes. The database contains tables for Countries, States/Province and then Towns. The Towns table is related by a foreign key to the States/Province table which is then linked to the Country table in the same manner. When the form loads, one of the three combo boxes needs be filled with the contents of the Country fields (a list of the available countries). The user may then select a Country from this combo box. Once this action is completed, another combo box below the one for the Countries will be populated with the States/Provinces available in that country. The user will select one of the available States which will then populate another combo box with a list of the Towns associated with the State from the database. When a town is selected, text boxes to the side of the combo box will be populated with the information for the respective town. I understand how to link a database to the ADO object and the general loop to populate a combo box. My problem is that I am uncertain how to program the arrangement of combo boxes I just described above. I am fairly novice at VB and very inexperienced at SQL so go easy on me.

MS DataGrid Control - Print & Search?
Hello,
I like to display data using the Microsoft DataGrid Control (SP4) (OLEDB). I want to know if it's possible to:

1) Print the grid and its data once the grid has been populated with data.
2) perform a search within the DataGrid
thx
Anakin

Search Datagrid For Specific String
I use Visual Basic Version 6, SP5.
I have a Datagrid that I use dynamically, the values will not reflect the database. I do need to search for either the string, "Pass or Fail", in lower or upper case, in columns 1 through 8, all rows. I looked everywhere on this site and could not find a example.

If the string is found, I just need to copy the information to a text box.

THX in advance.

BC

Returning Search Results In Datagrid
Hi guys, i am using MSflex datagrid, and i am trying to display in it the results of my search.

EX: a user performs a search on a particular string and i want to display in the datagrid all records in the database that contain the desired string.( no other records should be displayed expect for the ones returned from the search)

I am using MS access as my backend with DAO connection.

HOW DO I DISPLAY ONLY THE RECORDS THAT I NEED IN THE DATAGRID VS. ALL RECORDS CONTAINED IN THE DATABASE ???

Follow up questions: How can i remove certain columns, Can i have a completely unbound datagrid so that i could display information obtained from different databases.

thanx for the help

Displaying Search Results In Datagrid
hi all i'm supposed to get results from a database and show them on a datagrid using a search button. will my code work? and any way to improve on it? comments pls....

Dim ds As DataSet
Dim dr As DataRow
Dim myConnection As New SqlClient.SqlConnection
Dim myCommand As New SqlClient.SqlCommand
Dim adapter As New SqlDataAdapter

DataGrid.Visible = True
ds = New DataSet
adapter.SelectCommand = myCommand
adapter.SelectCommand.CommandText = myCommand.CommandText
adapter.SelectCommand.Connection = myConnection
adapter.Fill(ds, "Result")

Try
myConnection.ConnectionString = "Integrated Security=etc etc;"
myConnection.Open()

If name.Checked = True Then 'see which checkbox is clicked
myCommand.CommandText = "SELECT artist,title,serial FROM database ORDER BY artist"
Else
If title.Checked = True Then
myCommand.CommandText = "SELECT artist,title,serialno FROM database ORDER BY title"
End If
myCommand.CommandText = "SELECT artist,title,serialno FROM database ORDER BY serialno"
End If
myCommand.Connection = myConnection

DataGrid.DataSource = ds
Catch
End Try

Copyright 2005-08 www.BigResource.com, All rights reserved