hi all,
If I have a datagrid, actually has 5 column. but I would like in run
time hidden last column.
The reason is the form also have combobox for filter datagrid row. my
problem is that I don't want the filter key show in datagrid. so that's why
I would like to hidden it...any idea..
Thanks 4 6647
Is this a Windows Forms DataGrid? If so, you can set the column width
to zero to hide a column provided you have a non-Nothing tablestyle.
Here is some code snippets.
'.... make sure your DataGrid is using a tablestyle
dataGrid1.DataSource = _dataSet.Tables("customers")
Dim dgts As New DataGridTableStyle()
dgts.MappingName = "customers"
dataGrid1.TableStyles.Add(dgts)
'......
'method to set a column with by colnumber
Public Sub SetColWidth(tableStyle As DataGridTableStyle, colNum As
Integer, width As Integer)
Try
tableStyle.GridColumnStyles(colNum).Width = width
tableStyle.DataGrid.Refresh()
Catch 'empty catch .. do nothing
End Try
End Sub 'SetColWidth
'....
' here is how you might call this method
Private Sub button1_Click(sender As Object, e As System.EventArgs)
Dim tableStyle As DataGridTableStyle =
dataGrid1.TableStyles("customers")
SetColWidth(tableStyle, 1, 0) 'set width to zero
End Sub 'button1_Click
===============
Clay Burch
Syncfusion, Inc.
In the designer (or via code) you can toggle the columns Visible
property off.
HTH,
Wayne P.
ClayB wrote:
Is this a Windows Forms DataGrid? If so, you can set the column width
to zero to hide a column provided you have a non-Nothing tablestyle.
Here is some code snippets.
'.... make sure your DataGrid is using a tablestyle
dataGrid1.DataSource = _dataSet.Tables("customers")
Dim dgts As New DataGridTableStyle()
dgts.MappingName = "customers"
dataGrid1.TableStyles.Add(dgts)
'......
'method to set a column with by colnumber
Public Sub SetColWidth(tableStyle As DataGridTableStyle, colNum As
Integer, width As Integer)
Try
tableStyle.GridColumnStyles(colNum).Width = width
tableStyle.DataGrid.Refresh()
Catch 'empty catch .. do nothing
End Try
End Sub 'SetColWidth
'....
' here is how you might call this method
Private Sub button1_Click(sender As Object, e As System.EventArgs)
Dim tableStyle As DataGridTableStyle =
dataGrid1.TableStyles("customers")
SetColWidth(tableStyle, 1, 0) 'set width to zero
End Sub 'button1_Click
===============
Clay Burch
Syncfusion, Inc.
now is ok...
Thanks Clay
"ClayB" <cl***@syncfusion.com???
news:11**********************@p77g2000hsh.googlegr oups.com ???...
Is this a Windows Forms DataGrid? If so, you can set the column width
to zero to hide a column provided you have a non-Nothing tablestyle.
Here is some code snippets.
'.... make sure your DataGrid is using a tablestyle
dataGrid1.DataSource = _dataSet.Tables("customers")
Dim dgts As New DataGridTableStyle()
dgts.MappingName = "customers"
dataGrid1.TableStyles.Add(dgts)
'......
'method to set a column with by colnumber
Public Sub SetColWidth(tableStyle As DataGridTableStyle, colNum As
Integer, width As Integer)
Try
tableStyle.GridColumnStyles(colNum).Width = width
tableStyle.DataGrid.Refresh()
Catch 'empty catch .. do nothing
End Try
End Sub 'SetColWidth
'....
' here is how you might call this method
Private Sub button1_Click(sender As Object, e As System.EventArgs)
Dim tableStyle As DataGridTableStyle =
dataGrid1.TableStyles("customers")
SetColWidth(tableStyle, 1, 0) 'set width to zero
End Sub 'button1_Click
===============
Clay Burch
Syncfusion, Inc.
Thanks
I try it also ok..
"Wayne Pedersen" <wa************@no.spam.teksol.com???
news:%2****************@TK2MSFTNGP02.phx.gbl ???...
In the designer (or via code) you can toggle the columns Visible
property off.
HTH,
Wayne P.
ClayB wrote:
Is this a Windows Forms DataGrid? If so, you can set the column width
to zero to hide a column provided you have a non-Nothing tablestyle.
Here is some code snippets.
'.... make sure your DataGrid is using a tablestyle
dataGrid1.DataSource = _dataSet.Tables("customers")
Dim dgts As New DataGridTableStyle()
dgts.MappingName = "customers"
dataGrid1.TableStyles.Add(dgts)
'......
'method to set a column with by colnumber
Public Sub SetColWidth(tableStyle As DataGridTableStyle, colNum As
Integer, width As Integer)
Try
tableStyle.GridColumnStyles(colNum).Width = width
tableStyle.DataGrid.Refresh()
Catch 'empty catch .. do nothing
End Try
End Sub 'SetColWidth
'....
' here is how you might call this method
Private Sub button1_Click(sender As Object, e As System.EventArgs)
Dim tableStyle As DataGridTableStyle =
dataGrid1.TableStyles("customers")
SetColWidth(tableStyle, 1, 0) 'set width to zero
End Sub 'button1_Click
===============
Clay Burch
Syncfusion, Inc.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Derek |
last post by:
Another DGrid question...
I can not access the values of a cell in a datagrid unless
I make them visible. I do not want these fields
displayed. I only want to use the values to run a stored...
|
by: chris |
last post by:
Hello group,
The datagrid I use needs to add a hidden column on demand
(only on certain conditions). The sequence of events would be as below:
1) get the dataset(ds) and bind the datagrid(dg) with...
|
by: Brad |
last post by:
I'm working with a DataGrid in C#, and the user needs to be able add
and remove columns from the DataGrid on the fly, without opening and
closing the form. The scenario is this. I have a setup...
|
by: Jim Heavey |
last post by:
Trying to figure out the technique which should be used
to add rows to a datagrid. I am thinking that I would
want an "Add" button on the footer, but I am not quite
sure how to do that. Is that...
|
by: Ryan Riddell |
last post by:
I am using the DataGrid control from 4guys (http://aspnet.4guysfromrolla.com/demos/RowHighlighter.aspx). I want to display 2 columns and allow editing. The only column I want the user to be able to...
|
by: Mortar |
last post by:
i have a datagrid with 2 columns.
the 1st column contains an id which will be used by the database for
the selected checkbox records.
the 2nd column is a template column containing a server...
|
by: Not Me |
last post by:
Hi,
In a datagrid's itemcommand method, I can use
DataGridCommandEventArgs/item/cells/text to bring up a specific field
from a row that was accessed. However, I wish to lookup data from that...
|
by: Rich |
last post by:
I have a datagrid that uses a dataview object for its datasource. The
dataview contains a unique row identifier column. I don't want to display
this column in the datagrid. I need the unique row...
|
by: Mike Baugh |
last post by:
I am using visual studio 2005 to develop a form using c#
I have 3 datagrids on one form.
I can set the row color based on a certain value in a column. However this
color applies to all 3...
|
by: Doug Bell |
last post by:
Hi
I have a DataGrid with some hidden columns and also some read Only and some
ComboBox Columns.
Sandard Tabbing through the Datagrid sees the focus go to the hidden columns
requiring further...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |