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.

BIG problem ...

Thread ID:

Created:

Updated:

Platform:

Replies:

491 Jun 28,2002 11:34 PM Jun 30,2002 10:17 PM Windows Forms 2
loading
Tags: FAQ
Vipul Bhatt
Asked On June 28, 2002 11:34 PM

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.

Clay Burch [Syncfusion]
Replied On June 29, 2002 03:20 AM

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.

Vipul Bhatt
Replied On June 30, 2002 10:17 PM

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.

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.

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.

;