|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datagridview - Move Focus to a Particular CellI am trying to use the bindingnavigator addnewitem button to place the focus
on the first cell in the newrow row. I have disabled the default action and I am using the bindingnavigatoraddnewitem click event. Using newrowindex for the row how can I move the focus? >I am trying to use the bindingnavigator addnewitem button to place the DataGridView1.CurrentCell = DataGridView1(0, DataGridView1.NewRowIndex)>focus on the first cell in the newrow row. I have disabled the default >action and I am using the bindingnavigatoraddnewitem click event. Using >newrowindex for the row how can I move the focus? Found it! Hi,
Here is an example. I added a bindingnaviagator and datagridview to a form. Public Class Form1 Dim bs As New BindingSource Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim strConn As String = _ "Server = .;Database = NorthWind;" & _ "Integrated Security = SSPI;" Dim conn As New SqlClient.SqlConnection(strConn) Dim dt1 As New DataTable Dim da1 As New SqlClient.SqlDataAdapter _ ("Select * from Orders", conn) da1.Fill(dt1) bs.DataSource = dt1 DataGridView1.DataSource = bs BindingNavigator1.BindingSource = bs End Sub Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click bs.AddNew() bs.Position = bs.Count End Sub End Class Ken -------------------- Show quoteHide quote "Paul Remblance" <p***@remblance.co.uk> wrote in message news:4iotp5F4q62nU1@individual.net... >I am trying to use the bindingnavigator addnewitem button to place the >focus on the first cell in the newrow row. I have disabled the default >action and I am using the bindingnavigatoraddnewitem click event. Using >newrowindex for the row how can I move the focus? >
What is an assembly?
silly, probably meaninigless question DEBUG: can we disable try/catch ? How to ping an IP address by using sockets in Visual Basic .NET No accessible overloaded Compiling VB (.NET) files located in different directories Anyone can help me?£¬How to Convert C# to VB.NET, about Flood Fill Disabling the Form Designer Can WinCE & Pocket PC support the "AsyncCallback"? How is it work? |
|||||||||||||||||||||||