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. Image for the cookie policy date

BIG problem ...

Hi Clay. There is a BIG problem. Kindly have a look at the code below and the pic. file: '''''In Windows Form Generated Code '' Create a table each for 3 style parameters Public StyleCodeTable As DataTable Public ColorCodeTable As DataTable Public SizeCodeTable As DataTable '' Create a column each for 3 style parameter tables (Declared above) Public StyleCode As DataColumn Public ColorCode As DataColumn Public SizeCode As DataColumn Public ts As New DataGridTableStyle() Public cs As DataGridTextBoxColumn Public buttonColStyle As DataGridButtonColumn = Nothing '''''In Initialize Component Me.StyleCodeTable.Columns.AddRange(New System.Data.DataColumn() {Me.StyleCode}) Me.ColorCodeTable.Columns.AddRange(New System.Data.DataColumn() {Me.ColorCode})Me.SizeCodeTable.Columns.AddRange(New System.Data.DataColumn() {Me.SizeCode}) '''In form load DataGrid_StyleCode.DataSource = StyleCodeTable.DefaultView DataGrid_ColorCode.DataSource = ColorCodeTable.DefaultView DataGrid_SizeCode.DataSource = SizeCodeTable.DefaultView ''''''''Handles buttonclick in datagrid Private Sub HandleCellButtonClick(ByVal sender As Object, ByVal e As DataGridCellButtonClickEventArgs) StyleCodeTable.Rows.Clear() Dim arr As Array Dim i As Integer Dim str As String str = "" Select Case e.ColIndex Case 3 If Panel_Color.Visible = True Then Panel_Color.Visible = False If Panel_Size.Visible = True Then Panel_Size.Visible = False If Panel_Style.Visible = False Then Panel_Style.Visible = True arr = Split(DataGrid_Styles.Item(DataGrid_Styles.CurrentRowIndex, 2), ",") Try For i = 0 To UBound(arr) - 1 StyleCodeTable.DefaultView.AddNew() StyleCodeTable.DefaultView.Item(i).Item(0) = arr(i) 'str = str & arr(i) & ", " Next ''''''''On first click its ok but on second 'click it gives an error shown in zip of jpg. DataGrid_StyleCode.Focus() Catch MsgBox(Err.Number & ": " & Err.Description) End Try Case 5 If Panel_Size.Visible = True Then Panel_Size.Visible = False If Panel_Style.Visible = True Then Panel_Style.Visible = False If Panel_Color.Visible = False Then Panel_Color.Visible = True arr = Split(DataGrid_Styles.Item(DataGrid_Styles.CurrentRowIndex, 4), ",") For i = 0 To UBound(arr) - 1 Try ColorCodeTable.DefaultView.AddNew() Catch MsgBox(Err.Number & ": " & Err.Description) End Try ColorCodeTable.DefaultView.Item(i).Item(0) = arr(i) 'str = str & arr(i) & ", " Next 'As above On first click its ok but on second 'click it gives an error shown in zip of jpg. Datagrid_ColorCode.Focus() Case 7 If Panel_Color.Visible = True Then Panel_Color.Visible = False If Panel_Style.Visible = True Then Panel_Style.Visible = False If Panel_Size.Visible = False Then Panel_Size.Visible = True arr = Split(DataGrid_Styles.Item(DataGrid_Styles.CurrentRowIndex, 6), ",") For i = 0 To UBound(arr) - 1 'str = str & arr(i) & ", " Next 'As above On first click its ok but on second 'click it gives an error shown in zip of jpg. Datagrid_SizeCode.Focus() End Select End Sub ''The error occurs at place Public Class m_Style '''m_Style is the name of the .vb form.

2 Replies

CB Clay Burch Syncfusion Team June 29, 2002 07:20 AM UTC

You have aq StyleCodeTable.Rows.Clear() that is always hit in your buttonhandler, bot not all flow-paths in the handler add rows back. Is this what you want. Without a working sample that shows the problem to step through in the debugger, it will be difficult to be of help.


VB Vipul Bhatt July 1, 2002 02:17 AM UTC

Hi Clay. Got the problem. I had to delete individual rows instead of using Clear() method. Does Clear() method effect datatable or datacolumns in any way. well the help shows it deletes all the rows in the datable.

Loader.
Live Chat Icon For mobile
Up arrow icon