[英]how to position column names vertically in datagridview in vb.net
I appologise in advance if my question may appear silly to you but I have a problem with positioning column names in a dataGridview vertically. 如果我的问题对您来说似乎很愚蠢,我事先表示歉意,但我在垂直放置dataGridview中的列名时遇到问题。 I'm populating DataGridView using flowing code:
我正在使用流动代码填充DataGridView:
Dim StrQwery As String = "SELECT * FROM employees WHERE employee_id = (select MAX(employee_id) FROM employees AND registered = 'UNREGISTERED';
Dim smd As MySqlCommand
smd = New MySqlCommand(StrQwery, myconn)
smd.CommandType = CommandType.Text
Dim da As New MySqlDataAdapter(smd)
Dim cb As New MySqlCommandBuilder(da)
Dim ds As New DataSet()
da.Fill(ds)
GridView1.DataSource = ds.Tables(0)
If n = 1 Then
If Not Page.IsPostBack Then
GridView1.DataBind()
End If
Else
GridView1.DataBind()
End If
everything works perfectly except that I need to position account attributes like name, position, ID number etc not horizontally but vertically. 一切工作正常,除了我需要水平而不是垂直放置帐户属性(例如名称,位置,ID号等)。 Something like this:
像这样:
|NAME | | NAME | John |
约翰|
|SURNAME | | SURNAME | Philips|
飞利浦|
|POSITION| |位置| Manager|
经理|
and I can't find a way how to do it. 而且我找不到方法。 Can anyone give me a hint in my problem please?
任何人都可以给我提示我的问题吗?
many thanks in advance. 提前谢谢了。
If you want to present a detailed view of DB record, GridView is not the best choice (which is more suitable for tabular display of multiple records). 如果要显示数据库记录的详细视图,则GridView不是最佳选择(它更适合以表格形式显示多个记录)。
For your case take a look at DetailsView control 对于您的情况,请查看DetailsView控件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.