Subject: Data Value tracing Grid
Posted By: Anantsharma Post Date: 4/13/2005 10:47:30 PM
Hi Programmers,

Well I am in process to develope a Windows App in VB.NET.

I need to display some records (80-90 thousand rows) in a Grid. On the form, there will be a Textbox where user will type something. Typing anything here will have to trace the item in a particular column of grid and the moment user finds the required record, he will hit enter and the value from a columm from selected/traced record will be captured in a variable. I have done this a lot with VB6 using a class file and module and DbGrid control. You must be aware that the DbGrid of VB6 is bound to a recordset. Moving inside recorset, automatically moves a record pointer in DbGrid.

In VB.NET, DataGrid is also bound control. Can someone just give me an idea to open my wings towards this task.

I am looking for HOW TO logic and flow.

Hope you got my point !!!

Cheers...Anant

Reply By: jaucourt Reply Date: 4/27/2005 4:28:06 PM
You'd have to use the keypress event

    
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

    End Sub


Set the datasource of the datagrid to be a dataview. Every time a key is pressed, amend the RowFilter property of the dataview to be whatever has been typed in the textbox, for example:

dv.RowFilter=string.format("LastName='{0}'",textbox1.text)

Think this will do the trick. As for 'saving the values in a variable on enter', just trap the Leave event of the textbox and grab the first row of the dataview:

selectedRow=dv.Item(0)



Go to topic 29807

Return to index page 566
Return to index page 565
Return to index page 564
Return to index page 563
Return to index page 562
Return to index page 561
Return to index page 560
Return to index page 559
Return to index page 558
Return to index page 557