how can i refres a datagrid or close and open it again.
Datagrid
Collapse
X
-
Tags: None
-
I have written below code
Code:Try DG.TableStyles.Clear() DG.Refresh() sp_cnt = 0 DG.TableStyles.Clear() tablestyle.MappingName = mdetabname tablestyle.HeaderBackColor = System.Drawing.Color.Pink 'tablestyle.MappingName.Remove(0, Len(mdetabname)) Do If sacarray(sp_cnt) <> "" Then Dim tablestyle2 As New DataGridTextBoxColumn ' MsgBox(TableStyle1(0).ToString()) tablestyle2.MappingName = sacarray(sp_cnt) tablestyle2.Width = 100 tablestyle2.HeaderText = MappArray(sp_cnt) MsgBox(sacarray(sp_cnt) & " " & MappArray(sp_cnt)) tablestyle.GridColumnStyles.Add(tablestyle2) tablestyle2.Dispose() sp_cnt = sp_cnt + 1 Else Exit Do End If Loop DG.TableStyles.Add(tablestyle) DG.Refresh()
for
MappArray() - I m taking values from database and storing it in this array.
there are 50 different rows fro mapping array
these 50 rows are divided into 12 tables.
and mapping these two array in above code
At first it runs fine.
but when i try to apply different combination i m getting following error:
"Error: Datagrid columnstyle collection already contains a columnstyle
with the same mapping "
parameter name: column
please clarify how i can remove a columnstyle from a datagrid before applying new one.Comment
-
Thank You very much
I stored that datagridcolumns tyle to an array before adding.
and using that array i removed datagridcolumns tyle one bye one before adding new tablestyle.
I had worked on that code for 3 days so thanx once again.....Comment
Comment