By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

How can I do it?

P: n/a
Hi, all,

If I want to datagrid1 locate to row where dno="002",how can I do it?
Dim Conn As String = "Provider=vfpoledb;Data
Source=H:\BACKUP\NEWBACK1\RSKJGZ7\BACKNGX\DATA\gxr s.dbc"
Da = New OleDbDataAdapter("Select Dno,Dname From Department", Conn)
dt = New DataTable
Da.Fill(dt)
DataGrid1.DataSource=dt

Thanks in advance!

Chuen
Nov 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
"Chuen" <cn*****@hotmail.com> wrote in news:Oi6TqnKjEHA.2412
@TK2MSFTNGP15.phx.gbl:
If I want to datagrid1 locate to row where dno="002",how can I do it?


Apply a dataview. Or you can use the datatable's select method. Or you can
use the Find method (assuming dno is the PK).

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #2

P: n/a
Lucas,

As addition to Lucas, his answer and than: using the underlaying datasourcre
in your sample "dt".

Cor
Hi, all,

If I want to datagrid1 locate to row where dno="002",how can I do it?
Dim Conn As String = "Provider=vfpoledb;Data
Source=H:\BACKUP\NEWBACK1\RSKJGZ7\BACKNGX\DATA\gxr s.dbc"
Da = New OleDbDataAdapter("Select Dno,Dname From Department", Conn)
dt = New DataTable
Da.Fill(dt)
DataGrid1.DataSource=dt

Thanks in advance!

Chuen

Nov 21 '05 #3

P: n/a
Can you give me any examples?
Thanks In advance!

Chuen

"Chuen" <cn*****@hotmail.com> 写入邮件
news:Oi**************@TK2MSFTNGP15.phx.gbl...
Hi, all,

If I want to datagrid1 locate to row where dno="002",how can I do it?
Dim Conn As String = "Provider=vfpoledb;Data
Source=H:\BACKUP\NEWBACK1\RSKJGZ7\BACKNGX\DATA\gxr s.dbc"
Da = New OleDbDataAdapter("Select Dno,Dname From Department", Conn)
dt = New DataTable
Da.Fill(dt)
DataGrid1.DataSource=dt

Thanks in advance!

Chuen

Nov 21 '05 #4

P: n/a
Hi,

http://www.onteorasoftware.com/downl...taviewfind.zip

Ken
----------------------
"Chuen" <cn*****@hotmail.com> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
Can you give me any examples?
Thanks In advance!

Chuen

"Chuen" <cn*****@hotmail.com> 写入邮件
news:Oi**************@TK2MSFTNGP15.phx.gbl...
Hi, all,

If I want to datagrid1 locate to row where dno="002",how can I do it?
Dim Conn As String = "Provider=vfpoledb;Data
Source=H:\BACKUP\NEWBACK1\RSKJGZ7\BACKNGX\DATA\gxr s.dbc"
Da = New OleDbDataAdapter("Select Dno,Dname From Department", Conn)
dt = New DataTable
Da.Fill(dt)
DataGrid1.DataSource=dt

Thanks in advance!

Chuen


Nov 21 '05 #5

P: n/a
Chueng,

Maybe, however tell first something more what you want to archieve, because
(not knowing how it is with others) for me that is not clear.

The simplest answer on your question had been by instance, go to your screen
take the mouse and click on that row. However I assume that is not what you
want.

Cor
Can you give me any examples?
Thanks In advance!

Chuen

Nov 21 '05 #6

P: n/a
Thanks for your response, in my example as following,

Dim Conn As String = "Provider=vfpoledb;Data
Source=H:\BACKUP\NEWBACK1\RSKJGZ7\BACKNGX\DATA\gxr s.dbc"
Da = New OleDbDataAdapter("Select Dno,Dname From Department", Conn)
dt = New DataTable
Da.Fill(dt)
DataGrid1.DataSource=dt

dt has totally 800 rows. I means, if I put a command button(Cation: Find)
and a textbox named DnoText in form(which datagrid1 locates), when I input
any value in textbox and then click such command button, the datagrid1 will
locate to the row whose dno is value input in DnoText.

Thanks and hope that you can give me any idea!

Chuen

"Cor Ligthert" <no**********@planet.nl> 写入邮件
news:uq**************@TK2MSFTNGP10.phx.gbl...
Chueng,

Maybe, however tell first something more what you want to archieve, because (not knowing how it is with others) for me that is not clear.

The simplest answer on your question had been by instance, go to your screen take the mouse and click on that row. However I assume that is not what you want.

Cor
Can you give me any examples?
Thanks In advance!

Chuen


Nov 21 '05 #7

P: n/a
Thanks, but I can't access that address!

"Ken Tucker [MVP]" <vb***@bellsouth.net> 写入邮件
news:%2***************@tk2msftngp13.phx.gbl...
Hi,

http://www.onteorasoftware.com/downl...taviewfind.zip

Ken
----------------------
"Chuen" <cn*****@hotmail.com> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
Can you give me any examples?
Thanks In advance!

Chuen

"Chuen" <cn*****@hotmail.com> 写入邮件
news:Oi**************@TK2MSFTNGP15.phx.gbl...
Hi, all,

If I want to datagrid1 locate to row where dno="002",how can I do it?
Dim Conn As String = "Provider=vfpoledb;Data
Source=H:\BACKUP\NEWBACK1\RSKJGZ7\BACKNGX\DATA\gxr s.dbc"
Da = New OleDbDataAdapter("Select Dno,Dname From Department", Conn)
dt = New DataTable
Da.Fill(dt)
DataGrid1.DataSource=dt

Thanks in advance!

Chuen


Nov 21 '05 #8

P: n/a
Chuen,

The only simple idea I can come up is this.
(For this your datagrid should absolutly be set with sort off)

I hope this helps?

Cor
\\\ needs 1 datagrid 1 button and 1 textbox
Dim dt As New DataTable
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
dt.Columns.Add("datet", GetType(System.DateTime))
For i As Integer = 0 To 800
Dim dr As DataRow = dt.NewRow
dr(0) = Now.Date.AddDays(i)
dt.Rows.Add(dr)
Next
DataGrid1.DataSource = dt
DataGrid1.AllowSorting = False
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim mdt As Date = CDate(TextBox1.Text)
For I As Integer = 0 To 800
If DirectCast(dt.Rows(I)(0), Date) = mdt Then
DataGrid1.Select(I)
Exit Sub
End If
Next
End Sub
///
Nov 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.