91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

C#_winform_DataGridView_checkbox復選框_實現單選效果

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?System.Data.SqlClient;

namespace?WindowsFormsApplication2
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????using?(SqlConnection?con?=?new?SqlConnection())
????????????{
????????????????try
????????????????{

????????????????????DataTable?dt1?=?new?DataTable();
????????????????????dt1.Columns.Add(“編號“?typeof(int));
????????????????????dt1.Columns.Add(“姓名“?typeof(string));
????????????????????dt1.Columns.Add(“年齡“?typeof(int));
????????????????????dt1.Columns.Add(“性別“?typeof(string));

????????????????????dt1.Rows.Add(1?“小王“?20?“男“);
????????????????????dt1.Rows.Add(2?“王小兒“?30?“男“);
????????????????????dt1.Rows.Add(3?“李大媽“?40?“女“);
????????????????????dt1.Rows.Add(4?“王大嫂“?50?“女“);
????????????????????dt1.Rows.Add(5?“李敏“?60?“女“);
????????????????????dt1.Rows.Add(6?“老李“?70?“男“);

????????????????????dataGridView1.DataSource?=?dt1;
????????????????}
????????????????catch?{?}
????????????}
????????}
????????//單擊單元格(無論單擊的是單元格為內容還是單元格為列頭)。
????????private?void?dataGridView1_CellClick(object?sender?DataGridViewCellEventArgs?e)
????????{
????????????//判斷是否單擊了列頭??如果單擊了列頭e.RowIndex的值為-1;
????????????if?(e.RowIndex?>=?0)
????????????{
????????????????if?(e.ColumnIndex?==?0)
????????????????{
????????????????????this.txtBianhao.Text?=?dataGridView1.Rows[e.RowIndex].Cells[“編號“].Value.ToString();
????????????????????this.txtXingming.Text?=?dataGridView1.Rows[e.RowIndex].Cells[“姓名“].Value.ToString();
????????????????????this.txtNianling.Text?=?dataGridView1.Rows[e.RowIndex].Cells[“年齡“].Value.ToString();
????????????????????this.txtXingbie.Text?=?dataGridView1.Rows[e.RowIndex].Cells[“性別“].Value.ToString();
????????????????}
????????????}
????????}
????????//MultiSelect設置為fasle,用戶一次可以多選(按住ctrl鍵進行選擇,不然只為一條)??
????????//?始終在SelectedRows集合中只有一行
????????//如果沒有按住ctrl鍵進行點擊選擇無論MultiSelect設置為fasle或true始終選擇一行
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????//選擇的行數
????????????MessageBox.Show(“選擇的行數:“?+?dataGridView1.SelectedRows.Count.ToString());
????????????//選擇的行
????????????MessageBox.Show(“選擇的行[Index]:“?+?dataGridView1.SelectedRows[0].Cells[0].RowIndex.ToString());
????????}
????????//MultiSelect設置為true遍歷chexkBox選中的行
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????for?(int?p?=?0;?p?????????????{
????????????????MessageBox.Show(“選擇了第“?+?(int.Parse(dataGridView1.SelectedRows[p].Cells[0].RowIndex.ToString())?+?1).ToString()?+?“行“);
????????????}
????????}
????????#region
????????int?Las

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-01-06?15:26??C#_winform_DataGridView_checkbox復選框_實現單選效果\
?????目錄???????????0??2017-01-06?15:27??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\
?????目錄???????????0??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\
?????文件?????????962??2013-09-14?21:02??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2.sln
?????文件???????28160??2013-09-14?22:50??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2.v11.suo
?????文件???????46592??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2.v12.suo
?????文件?????????187??2013-09-14?21:01??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\App.config
?????目錄???????????0??2013-09-14?21:01??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\bin\
?????目錄???????????0??2013-09-14?21:07??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\bin\Debug\
?????文件???????14848??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe
?????文件?????????187??2013-09-14?21:01??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe.config
?????文件???????28160??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.pdb
?????文件???????24224??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe
?????文件?????????187??2013-09-14?21:01??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.config
?????文件?????????490??2013-03-18?17:00??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.manifest
?????文件????????5349??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\Form1.cs
?????文件???????10868??2017-01-06?16:09??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\Form1.Designer.cs
?????文件????????7649??2017-01-06?16:09??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\Form1.resx
?????目錄???????????0??2013-09-14?21:01??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\
?????目錄???????????0??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\
?????文件?????????865??2017-01-06?15:38??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????7311??2017-01-06?15:27??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????????0??2013-09-14?21:02??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件???????????0??2013-09-14?21:02??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件???????????0??2013-09-14?21:02??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????目錄???????????0??2013-09-14?21:02??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\TempPE\
?????文件????????2793??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt
?????文件?????????977??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csproj.GenerateResource.Cache
?????文件????????2211??2017-01-06?15:27??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csprojResolveAssemblyReference.cache
?????文件???????14848??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.exe
?????文件?????????180??2017-01-06?16:10??C#_winform_DataGridView_checkbox復選框_實現單選效果\DataGridView摸索\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.Form1.resources
............此處省略10個文件信息

評論

共有 條評論