We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

inseting into dataGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

759 Aug 13,2002 09:45 AM UTC Oct 3,2002 05:49 PM UTC Windows Forms 2
loading
Tags: FAQ
ramez
Asked On August 13, 2002 09:45 AM UTC

1)how can i know if the user is know inserting inforamtion in new row 2)w can i pervent him to add i want to him just to update 3)how can i put a value (the user can't change it)into a column

Frank
Replied On September 26, 2002 08:39 PM UTC

> 1)how can i know if the user is know inserting inforamtion in new row > > 2)w can i pervent him to add i want to him just to update > > 3)how can i put a value (the user can't change it)into a column I can answer the 3rd part. To get a default value, you can set a default value for the underlying column (of the DataSet). DataSetName.TableName.FieldNameColumn.DefaultValue = "Default"; Keeping the user from editing the value can be done by adding DataGridColumnStyle to you DataGrid -- one of the fields is ReadOnly.

Administrator [Syncfusion]
Replied On October 3, 2002 05:49 PM UTC

> 1)how can i know if the user is know inserting inforamtion in new row > > 2)w can i pervent him to add i want to him just to update > > 3)how can i put a value (the user can't change it)into a column In regards to question #2. See DataGrid Faq question #5.5 Disabling the add new row. To do this in vb.net: Dim strCS As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=C:\northwind.mdb" Dim strSQL As String = "SELECT * FROM customers" ' Connection Object. Dim oConn As New OleDb.OleDbConnection(strCS) 'Create data adapter object. Dim oDAdapt As New OleDb.OleDbDataAdapter(strSQL, oConn) ' Create a dataset object & fill with data using data adapter's fill method. Dim oDSet As New DataSet() oDAdapt.Fill(oDSet, "customers") ' Attach dataset's DefaultView to the DataGrid control. dgTable.DataSource = oDSet.Tables("customers") ' Get reference to dataview and disable allow new. Dim oDView As DataView = oDSet.Tables("customers").DefaultView oDView.AllowNew = False ' If you wanted to allow users to add new rows but without using ' the tab key you could do this, create an ' insert function along the lines of the following. Dim iCount As Integer Dim oDView As DataView = oDSet.Tables("customers").DefaultView iCount = dgTable.BindingContext(dgTable.DataSource, dgTable.DataMember).Count If dgTable.CurrentRowIndex <> iCount Then oDView.AllowNew = True oDView.AddNew() dgTable.CurrentRowIndex = iCount dgTable.Focus() dvTable.AllowNew = False End If

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;