主婦と.NETと犬のぶろぐ

奥様 と プログラム と お犬様 の 楽しい日常

目次

Blog 利用状況

ニュース

書庫

日記カテゴリ

DataGridView(System.Windows.Forms.DataGridView)その1

今日から何回か DataGridView です。
DataGridView は機能がいっぱいありすぎて一日では遊びきれません。
しかも何から手を付けてよいやら...
困ったなぁ...
(特にコントロール関連で)困った時には、えムナウのプログラミングのページ です。

ってことで、
DataGridViewコントロール-内部コントロールの種類(えムナウのプログラミングのページ) にある
画像の"もどき"を、VB で実装してみました。( BindingNavigator は除く...)

■参考文献
DataGridViewコントロール-内部コントロールの種類(えムナウのプログラミングのページ)
DataGridView コントロール (Windows フォーム)
DataGridView クラス
DataGridViewColumn クラス
DataGridViewTextBoxColumn クラス
DataGridViewImageColumn クラス
DataGridViewCheckBoxColumn クラス
DataGridViewComboBoxColumn クラス
DataGridViewLinkColumn クラス
DataGridViewButtonColumn クラス

■実行画像
DataGridView その1

Public Class DataGridViewTest

Private Sub DataGridViewTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Size = New Size(600, 300)
'' TabControl に DataGridView を描画する。 Dim tabCntrl As TabControl = New TabControl Me.Controls.Add(tabCntrl) tabCntrl.Dock = DockStyle.Fill
tabCntrl.TabPages.Clear() ' TabPage の追加 Dim dgView1 As DataGridView = New DataGridView Me.AddTabPage(tabCntrl, "DataGridViewコントロール-内部コントロールの種類", dgView1) Me.DataGridViewコントロール_内部コントロールの種類(dgView1)
End Sub
Private Sub DataGridViewコントロール_内部コントロールの種類(ByVal dgView As DataGridView)
dgView.Columns.Clear() ' Text Dim textCol As DataGridViewTextBoxColumn = New DataGridViewTextBoxColumn textCol.HeaderText = "Text" textCol.Width = 50 dgView.Columns.Add(textCol)
' Image Dim imageCol As DataGridViewImageColumn = New DataGridViewImageColumn imageCol.HeaderText = "Image" imageCol.Width = My.Resources.中さん.Width ' 中さんの幅に合わせる dgView.Columns.Add(imageCol)
' Check Dim checkCol As DataGridViewCheckBoxColumn = New DataGridViewCheckBoxColumn checkCol.HeaderText = "Check" checkCol.Width = 50 dgView.Columns.Add(checkCol)
' Combo Dim comboCol As DataGridViewComboBoxColumn = New DataGridViewComboBoxColumn comboCol.HeaderText = "Combo" comboCol.Width = 100 dgView.Columns.Add(comboCol)
' コンボボックスのデータソースを作る。 Dim comboSource As DataTable = New DataTable("dogkind") comboSource.Columns.Add("kindName", GetType(String)) comboSource.Rows.Add("Shiba") comboSource.Rows.Add("Dachshund")
comboCol.DataSource = comboSource comboCol.DisplayMember = comboSource.Columns(0).ColumnName
' Link Dim linkCol As DataGridViewLinkColumn = New DataGridViewLinkColumn linkCol.HeaderText = "Link" linkCol.LinkColor = Color.LightSeaGreen ' リンクの色を変える linkCol.Width = 100 dgView.Columns.Add(linkCol)
' Button Dim buttonCol As DataGridViewButtonColumn = New DataGridViewButtonColumn buttonCol.HeaderText = "Button" buttonCol.Width = 100 dgView.Columns.Add(buttonCol)
'' 行を追加する Dim index As Integer = dgView.Rows.Add("わんくま", My.Resources.中さん, True, "Shiba", "LinkTest", "ButtonTest") dgView.Rows(index).Height = My.Resources.中さん.Height ' 中さんの高さに合わせる
'' Cell の中身がクリックされた時のイベントハンドラを登録する AddHandler dgView.CellContentClick, AddressOf OnCellContentClick End Sub
' Cell の中身がクリックされた時のイベントハンドラ Private Sub OnCellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) If e.ColumnIndex = 1 AndAlso e.RowIndex = 0 Then MessageBox.Show("中さんがくりっくされました") Else Dim dgView As DataGridView = DirectCast(sender, DataGridView) MessageBox.Show(dgView.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString()) End If End Sub
' TabPage を追加する Private Sub AddTabPage(ByVal tabCntrl As TabControl, _ ByVal tabPageText As String, _ ByVal dgView As DataGridView)
Dim tp As TabPage = New TabPage(tabPageText) tp.Controls.Add(dgView) dgView.Dock = DockStyle.Fill tabCntrl.TabPages.Add(tp) End Sub End Class

投稿日時 : 2006年12月19日 14:35

Feedback

# re: DataGridView(System.Windows.Forms.DataGridView)その1 2006/12/19 18:10 シャノン

いーなー。DataGridView使いたいなー。
今の仕事は .NET 1.1。DataGridしか使えません。
でも「コンボボックスを載せろ」って言われるような予感がしてる。

# re: DataGridView(System.Windows.Forms.DataGridView)その1 2006/12/20 1:13 なおこ(・∀・)

>> シャノンさん
DataGrid だと、どぼん!さんの↓コレでしょうか。
http://codezine.jp/a/article/aid/3.aspx

# re: DataGridView(System.Windows.Forms.DataGridView)その1 2006/12/20 6:52 επιστημη

なるほどー、わんくまの中さんは要チェックな柴なのかー

# DataGridView(System.Windows.Forms.DataGridView)その2 2006/12/20 12:51 主婦と.NETと犬のぶろぐ

DataGridView(System.Windows.Forms.DataGridView)その2

# re: DataGridView(System.Windows.Forms.DataGridView)その1 2006/12/20 12:54 なおこ(・∀・)

>> えぴさん
中さんはくまじゃなかったでしたっけ。。。?

# aiIDHDomVsh 2011/12/13 18:24 http://www.d4women.net/alesse.php

This article is for professionals..!

# ipymgGxdrxxXOFbR 2012/01/07 7:42 http://www.luckyvitamin.com/c-361-kava-kava

Can be also this issue because the truth can be achieved only in a dispute :D

# re: Internet Explorer 11 で、右クリックしたときに表示されるメニューで、Bingではなく、Google をデフォルトの検索エンジンとして設定するには? 2017/12/08 18:12 meadc

http://www.nfl-shop.co nfl store
http://www.nike-chaussures.fr/ Air Max TN Homme
http://www.culinar-hannover.de/ Nike Air Force
http://www.pradahandbags.co prada handbags
http://www.burberry-outletsale.us/ burberry outlet sale store
me adc12.8

# My brother suggested I might like this web site. He was entirely right. This post truly made my day. You can not imagine just how much time I had spent for this information! Thanks! 2021/07/22 7:20 My brother suggested I might like this web site.

My brother suggested I might like this web site.

He was entirely right. This post truly made my day. You can not imagine just
how much time I had spent for this information! Thanks!

# My brother suggested I might like this web site. He was entirely right. This post truly made my day. You can not imagine just how much time I had spent for this information! Thanks! 2021/07/22 7:21 My brother suggested I might like this web site.

My brother suggested I might like this web site.

He was entirely right. This post truly made my day. You can not imagine just
how much time I had spent for this information! Thanks!

# My brother suggested I might like this web site. He was entirely right. This post truly made my day. You can not imagine just how much time I had spent for this information! Thanks! 2021/07/22 7:22 My brother suggested I might like this web site.

My brother suggested I might like this web site.

He was entirely right. This post truly made my day. You can not imagine just
how much time I had spent for this information! Thanks!

# Hi there everybody, here every person is sharing these kinds of know-how, therefore it's good to read this website, and I used to pay a visit this web site everyday. 2021/07/22 8:13 Hi there everybody, here every person is sharing t

Hi there everybody, here every person is sharing these kinds of know-how, therefore it's good to read this
website, and I used to pay a visit this web site everyday.

# Hi there everybody, here every person is sharing these kinds of know-how, therefore it's good to read this website, and I used to pay a visit this web site everyday. 2021/07/22 8:14 Hi there everybody, here every person is sharing t

Hi there everybody, here every person is sharing these kinds of know-how, therefore it's good to read this
website, and I used to pay a visit this web site everyday.

# I am not sure where you're getting your information, but great topic. I needs to spend some time learning more or understanding more. Thanks for great information I was looking for this info for my mission. 2021/07/23 5:53 I am not sure where you're getting your informatio

I am not sure where you're getting your information, but great topic.
I needs to spend some time learning more or understanding more.

Thanks for great information I was looking for this info for my
mission.

# I am not sure where you're getting your information, but great topic. I needs to spend some time learning more or understanding more. Thanks for great information I was looking for this info for my mission. 2021/07/23 5:54 I am not sure where you're getting your informatio

I am not sure where you're getting your information, but great topic.
I needs to spend some time learning more or understanding more.

Thanks for great information I was looking for this info for my
mission.

# I am not sure where you're getting your information, but great topic. I needs to spend some time learning more or understanding more. Thanks for great information I was looking for this info for my mission. 2021/07/23 5:57 I am not sure where you're getting your informatio

I am not sure where you're getting your information, but great topic.
I needs to spend some time learning more or understanding more.

Thanks for great information I was looking for this info for my
mission.

# Having read this I believed it was really informative. I appreciate you spending some time and effort to put this short article together. I once again find myself personally spending way too much time both reading and leaving comments. But so what, it wa 2021/07/23 6:28 Having read this I believed it was really informat

Having read this I believed it was really informative.
I appreciate you spending some time and effort to put this
short article together. I once again find myself personally spending way too
much time both reading and leaving comments.
But so what, it was still worthwhile!

# Having read this I believed it was really informative. I appreciate you spending some time and effort to put this short article together. I once again find myself personally spending way too much time both reading and leaving comments. But so what, it wa 2021/07/23 6:29 Having read this I believed it was really informat

Having read this I believed it was really informative.
I appreciate you spending some time and effort to put this
short article together. I once again find myself personally spending way too
much time both reading and leaving comments.
But so what, it was still worthwhile!

# Simply want to say your article is as amazing. The clearness in your post is simply great and i can assume you are an expert on this subject. Well with your permission let me to grab your feed to keep up to date with forthcoming post. Thanks a million 2021/07/23 7:12 Simply want to say your article is as amazing. The

Simply want to say your article is as amazing.
The clearness in your post is simply great and i can assume you
are an expert on this subject. Well with your permission let me to grab your feed to keep up to date with forthcoming
post. Thanks a million and please continue the gratifying work.

# Simply want to say your article is as amazing. The clearness in your post is simply great and i can assume you are an expert on this subject. Well with your permission let me to grab your feed to keep up to date with forthcoming post. Thanks a million 2021/07/23 7:12 Simply want to say your article is as amazing. The

Simply want to say your article is as amazing.
The clearness in your post is simply great and i can assume you
are an expert on this subject. Well with your permission let me to grab your feed to keep up to date with forthcoming
post. Thanks a million and please continue the gratifying work.

# This is very fascinating, You're an overly skilled blogger. I have joined your feed and look forward to searching for extra of your wonderful post. Additionally, I've shared your website in my social networks 2021/07/23 8:45 This is very fascinating, You're an overly skilled

This is very fascinating, You're an overly skilled blogger.
I have joined your feed and look forward to searching for extra of your wonderful post.
Additionally, I've shared your website in my social networks

# This is very fascinating, You're an overly skilled blogger. I have joined your feed and look forward to searching for extra of your wonderful post. Additionally, I've shared your website in my social networks 2021/07/23 8:49 This is very fascinating, You're an overly skilled

This is very fascinating, You're an overly skilled blogger.
I have joined your feed and look forward to searching for extra of your wonderful post.
Additionally, I've shared your website in my social networks

# This is very fascinating, You're an overly skilled blogger. I have joined your feed and look forward to searching for extra of your wonderful post. Additionally, I've shared your website in my social networks 2021/07/23 8:52 This is very fascinating, You're an overly skilled

This is very fascinating, You're an overly skilled blogger.
I have joined your feed and look forward to searching for extra of your wonderful post.
Additionally, I've shared your website in my social networks

# It's actually very complex in this full of activity life to listen news on TV, thus I only use the web for that purpose, and obtain the latest news. 2021/07/23 12:07 It's actually very complex in this full of activit

It's actually very complex in this full of activity life to listen news
on TV, thus I only use the web for that purpose, and obtain the latest
news.

# It's actually very complex in this full of activity life to listen news on TV, thus I only use the web for that purpose, and obtain the latest news. 2021/07/23 12:08 It's actually very complex in this full of activit

It's actually very complex in this full of activity life to listen news
on TV, thus I only use the web for that purpose, and obtain the latest
news.

# Hey there! Someone in my Myspace group shared this website with us so I came to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Fantastic blog and wonderful design and style. 2021/08/04 12:05 Hey there! Someone in my Myspace group shared this

Hey there! Someone in my Myspace group shared this website with us
so I came to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers!
Fantastic blog and wonderful design and style.

# Hey there! Someone in my Myspace group shared this website with us so I came to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Fantastic blog and wonderful design and style. 2021/08/04 12:07 Hey there! Someone in my Myspace group shared this

Hey there! Someone in my Myspace group shared this website with us
so I came to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers!
Fantastic blog and wonderful design and style.

# Hey there! Someone in my Myspace group shared this website with us so I came to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Fantastic blog and wonderful design and style. 2021/08/04 12:07 Hey there! Someone in my Myspace group shared this

Hey there! Someone in my Myspace group shared this website with us
so I came to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers!
Fantastic blog and wonderful design and style.

# Hey there! Someone in my Myspace group shared this website with us so I came to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Fantastic blog and wonderful design and style. 2021/08/04 12:08 Hey there! Someone in my Myspace group shared this

Hey there! Someone in my Myspace group shared this website with us
so I came to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers!
Fantastic blog and wonderful design and style.

# I'm not sure exactly why but this web site is loading extremely slow for me. Is anyone else having this problem or is it a problem on my end? I'll check back later on and see if the problem still exists. 2021/08/22 23:03 I'm not sure exactly why but this web site is load

I'm not sure exactly why but this web site is loading extremely slow
for me. Is anyone else having this problem or is it a problem on my end?
I'll check back later on and see if the problem still exists.

# I'm not sure exactly why but this web site is loading extremely slow for me. Is anyone else having this problem or is it a problem on my end? I'll check back later on and see if the problem still exists. 2021/08/22 23:05 I'm not sure exactly why but this web site is load

I'm not sure exactly why but this web site is loading extremely slow
for me. Is anyone else having this problem or is it a problem on my end?
I'll check back later on and see if the problem still exists.

# I'm not sure exactly why but this web site is loading extremely slow for me. Is anyone else having this problem or is it a problem on my end? I'll check back later on and see if the problem still exists. 2021/08/22 23:07 I'm not sure exactly why but this web site is load

I'm not sure exactly why but this web site is loading extremely slow
for me. Is anyone else having this problem or is it a problem on my end?
I'll check back later on and see if the problem still exists.

# I'm not sure exactly why but this web site is loading extremely slow for me. Is anyone else having this problem or is it a problem on my end? I'll check back later on and see if the problem still exists. 2021/08/22 23:09 I'm not sure exactly why but this web site is load

I'm not sure exactly why but this web site is loading extremely slow
for me. Is anyone else having this problem or is it a problem on my end?
I'll check back later on and see if the problem still exists.

# When some one searches for his required thing, therefore he/she needs to be available that in detail, therefore that thing is maintained over here. 2021/09/11 3:32 When some one searches for his required thing, the

When some one searches for his required thing, therefore
he/she needs to be available that in detail, therefore that thing is
maintained over here.

# When some one searches for his required thing, therefore he/she needs to be available that in detail, therefore that thing is maintained over here. 2021/09/11 3:35 When some one searches for his required thing, the

When some one searches for his required thing, therefore
he/she needs to be available that in detail, therefore that thing is
maintained over here.

# When some one searches for his required thing, therefore he/she needs to be available that in detail, therefore that thing is maintained over here. 2021/09/11 3:36 When some one searches for his required thing, the

When some one searches for his required thing, therefore
he/she needs to be available that in detail, therefore that thing is
maintained over here.

# Wonderful, what a weblog it is! This blog presents helpful data to us, keep it up. 2021/10/03 14:55 Wonderful, what a weblog it is! This blog presents

Wonderful, what a weblog it is! This blog presents helpful data to us, keep it up.

# Wonderful, what a weblog it is! This blog presents helpful data to us, keep it up. 2021/10/03 14:56 Wonderful, what a weblog it is! This blog presents

Wonderful, what a weblog it is! This blog presents helpful data to us, keep it up.

# Wonderful, what a weblog it is! This blog presents helpful data to us, keep it up. 2021/10/03 14:56 Wonderful, what a weblog it is! This blog presents

Wonderful, what a weblog it is! This blog presents helpful data to us, keep it up.

# Wonderful, what a weblog it is! This blog presents helpful data to us, keep it up. 2021/10/03 14:57 Wonderful, what a weblog it is! This blog presents

Wonderful, what a weblog it is! This blog presents helpful data to us, keep it up.

# Hi all, here every one is sharing these kinds of experience, thus it's pleasant to read this weblog, and I used to visit this blog daily. 2021/10/03 23:04 Hi all, here every one is sharing these kinds of

Hi all, here every one is sharing these kinds of experience, thus it's pleasant to
read this weblog, and I used to visit this blog daily.

# Hi all, here every one is sharing these kinds of experience, thus it's pleasant to read this weblog, and I used to visit this blog daily. 2021/10/03 23:04 Hi all, here every one is sharing these kinds of

Hi all, here every one is sharing these kinds of experience, thus it's pleasant to
read this weblog, and I used to visit this blog daily.

# Hi all, here every one is sharing these kinds of experience, thus it's pleasant to read this weblog, and I used to visit this blog daily. 2021/10/03 23:05 Hi all, here every one is sharing these kinds of

Hi all, here every one is sharing these kinds of experience, thus it's pleasant to
read this weblog, and I used to visit this blog daily.

# Hi all, here every one is sharing these kinds of experience, thus it's pleasant to read this weblog, and I used to visit this blog daily. 2021/10/03 23:05 Hi all, here every one is sharing these kinds of

Hi all, here every one is sharing these kinds of experience, thus it's pleasant to
read this weblog, and I used to visit this blog daily.

# This web site definitely has all of the information I wanted concerning this subject and didn't know who to ask. 2021/10/03 23:24 This web site definitely has all of the informatio

This web site definitely has all of the information I wanted concerning this subject
and didn't know who to ask.

# This web site definitely has all of the information I wanted concerning this subject and didn't know who to ask. 2021/10/03 23:24 This web site definitely has all of the informatio

This web site definitely has all of the information I wanted concerning this subject
and didn't know who to ask.

# This web site definitely has all of the information I wanted concerning this subject and didn't know who to ask. 2021/10/03 23:25 This web site definitely has all of the informatio

This web site definitely has all of the information I wanted concerning this subject
and didn't know who to ask.

# This web site definitely has all of the information I wanted concerning this subject and didn't know who to ask. 2021/10/03 23:25 This web site definitely has all of the informatio

This web site definitely has all of the information I wanted concerning this subject
and didn't know who to ask.

# Hey there! Do you know if they make any plugins to safeguard against hackers? I'm kinda paranoid about losing everything I've worked hard on. Any recommendations? 2021/10/05 21:52 Hey there! Do you know if they make any plugins to

Hey there! Do you know if they make any plugins to safeguard against hackers?
I'm kinda paranoid about losing everything I've worked
hard on. Any recommendations?

# Hey there! Do you know if they make any plugins to safeguard against hackers? I'm kinda paranoid about losing everything I've worked hard on. Any recommendations? 2021/10/05 21:52 Hey there! Do you know if they make any plugins to

Hey there! Do you know if they make any plugins to safeguard against hackers?
I'm kinda paranoid about losing everything I've worked
hard on. Any recommendations?

# Hey there! Do you know if they make any plugins to safeguard against hackers? I'm kinda paranoid about losing everything I've worked hard on. Any recommendations? 2021/10/05 21:53 Hey there! Do you know if they make any plugins to

Hey there! Do you know if they make any plugins to safeguard against hackers?
I'm kinda paranoid about losing everything I've worked
hard on. Any recommendations?

# Hey there! Do you know if they make any plugins to safeguard against hackers? I'm kinda paranoid about losing everything I've worked hard on. Any recommendations? 2021/10/05 21:53 Hey there! Do you know if they make any plugins to

Hey there! Do you know if they make any plugins to safeguard against hackers?
I'm kinda paranoid about losing everything I've worked
hard on. Any recommendations?

タイトル  
名前  
Url
コメント