DataGridView manually add a control column method (figure)

Source: Internet
Author: User


DataGridView manually add control column methods, from the network, back up, so as not to forget. Oh...


DataGridView Edit, add a random column, set to not display.

Then you can add the code.

'++++++++++++++++++++++++++++++
' Specifies the number of rows appended
DATAGRIDVIEW1.ROWS.ADD (20)
'----------------------------------------------------

'++++++++++++++++++++++++++++++
' Custom set cursor into cell edit mode (edit mode)
Datagridview1.editmode = Datagridvieweditmode.editonenter
'----------------------------------------------------

'++++++++++++++++++++++++++++++
' The blank column in front of the table does not show
Datagridview1.rowheadersvisible = False
'----------------------------------------------------

  ' ++++++++++++++++++++++++++++++
        ' checkbox column を append する
        Dim column as New datagridviewcheckboxcolumn
        column. Width =
        DATAGRIDVIEW1.COLUMNS.ADD (column)
  '------------------------------ ----------------------

'++++++++++++++++++++++++++++++
' datagridviewtextboxcolumn column を as する
Dim TextColumn as New datagridviewtextboxcolumn ()
' データソースの ' Column1 ' をバインドする
Textcolumn.datapropertyname = "TXTCLM"
' Name before とヘッダーを set する
Textcolumn.name = "TXTCLM"
Textcolumn.headertext = "TXTCLM"
' Column を append する
DATAGRIDVIEW1.COLUMNS.ADD (TextColumn)
'----------------------------------------------------


'++++++++++++++++++++++++++++++
Dim Columncmbox as New datagridviewcomboboxcolumn ()
' comboboxのリストに says する project を designated する
COLUMNCMBOX.ITEMS.ADD ("Item 1")
COLUMNCMBOX.ITEMS.ADD ("Item 2")
The ' Week ' column にバインドされているデータを represents する
Columncmbox.datapropertyname = "CMBCLM"
The ' Week ' わりにcombobox column を represents する
DataGridView1.Columns.Insert (2, Columncmbox)
' DataGridView1.Columns.Remove ("CMBCLM")
Columncmbox.name = "CMBCLM"
'----------------------------------------------------

'++++++++++++++++++++++++++++++
' Datagridviewlinkcolumnの made
Dim Columnlnk as New datagridviewlinkcolumn ()
' List of names before を setting
Columnlnk.name = "Link"
' Full てのリンクに ' detailed newspaper 覧 ' と says する
Columnlnk.usecolumntextforlinkvalue = True
Columnlnk.text = "Detailed newspaper 覧"
' マウスポインタがリンク on にあるときだけ をつける
Columnlnk.linkbehavior = Linkbehavior.hoverunderline
' Self-i interview 済 みとならないようにする
' デフォルトでtrue
Columnlnk.trackvisitedstate = True
' Datagridviewに append する
DATAGRIDVIEW1.COLUMNS.ADD (Columnlnk)
'----------------------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.