datagridview

Matching the values of Split string in if condition

亡梦爱人 提交于 2020-01-25 08:44:24
问题 What I'm trying to achieve is to match the Source doc no. of PER SAWT to P ER MAP . If it matches it will automatically check the CheckBox and it will set the BackColor to Color.Yellow . But when I try to split the Source Doc in PER MAP , it will only get the 2nd Value which is BS091 as per screenshot in 1st Scenario. My code work in 2nd scenario. 1st Scenario 2nd Senario Here is the code: For x As Integer = 0 To Me.DataGridView4.Rows.Count - 1 Dim sdoc_sawt As String = DataGridView4.Rows(x)

Matching the values of Split string in if condition

大兔子大兔子 提交于 2020-01-25 08:44:11
问题 What I'm trying to achieve is to match the Source doc no. of PER SAWT to P ER MAP . If it matches it will automatically check the CheckBox and it will set the BackColor to Color.Yellow . But when I try to split the Source Doc in PER MAP , it will only get the 2nd Value which is BS091 as per screenshot in 1st Scenario. My code work in 2nd scenario. 1st Scenario 2nd Senario Here is the code: For x As Integer = 0 To Me.DataGridView4.Rows.Count - 1 Dim sdoc_sawt As String = DataGridView4.Rows(x)

DataGridView DateTimePicker Column - add Long Format support (Date and the Time)

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-25 07:09:29
问题 I'm trying to make gridview Datetimepicker column and i succeeded, but i have a little problem that when the user edit the date in the gridview the date appear in short "11/9/16" but what i want is the date and the time together"11/9/16 2:34:45 AM" This is the code I use: CalendarColumn: Imports System Imports System.Windows.Forms Public Class CalendarColumn Inherits DataGridViewColumn Public Sub New() MyBase.New(New CalendarCell()) End Sub Public Overrides Property CellTemplate() As

DataGridView DateTimePicker Column - add Long Format support (Date and the Time)

自古美人都是妖i 提交于 2020-01-25 07:09:17
问题 I'm trying to make gridview Datetimepicker column and i succeeded, but i have a little problem that when the user edit the date in the gridview the date appear in short "11/9/16" but what i want is the date and the time together"11/9/16 2:34:45 AM" This is the code I use: CalendarColumn: Imports System Imports System.Windows.Forms Public Class CalendarColumn Inherits DataGridViewColumn Public Sub New() MyBase.New(New CalendarCell()) End Sub Public Overrides Property CellTemplate() As

Save changes from dataGridView to SQL Server DB

狂风中的少年 提交于 2020-01-25 02:09:47
问题 I have a form with dataGridView to display content of table Attendance TagID SessionID ScanningTime --------------------------------------- 4820427 Test1 14/08/2013 18:12 I would like to add a record manually to the table to look like this.... TagID SessionID ScanningTime --------------------------------------- 4820000 Test1 14/08/2013 18:12 0000001 Test2 15/08/2012 17:00 ...and save changes to SQL Server database after button has been clicked. I have tried creating UPDATE query: command.Text

Save changes from dataGridView to SQL Server DB

只谈情不闲聊 提交于 2020-01-25 02:09:32
问题 I have a form with dataGridView to display content of table Attendance TagID SessionID ScanningTime --------------------------------------- 4820427 Test1 14/08/2013 18:12 I would like to add a record manually to the table to look like this.... TagID SessionID ScanningTime --------------------------------------- 4820000 Test1 14/08/2013 18:12 0000001 Test2 15/08/2012 17:00 ...and save changes to SQL Server database after button has been clicked. I have tried creating UPDATE query: command.Text

DataGridView change cells background and restore default style

霸气de小男生 提交于 2020-01-24 20:20:07
问题 In my DGV, after clicking on a cell, I want to change the background color of all the cells of the same column with some value. After clicking on another cell, the previous cell (and all its column) must restore default style int currCell = dgvLogHeader.CurrentCell.ColumnIndex; string pattern = dgvLogHeader.CurrentCell.Value.ToString(); dgvLogHeader.AlternatingRowsDefaultCellStyle.BackColor = SystemColors.ScrollBar; dgvLogHeader.DefaultCellStyle.BackColor = SystemColors.Info; for (int j=0; j

Insert and Update syntax error on Database / Datagrid

萝らか妹 提交于 2020-01-24 20:16:06
问题 Here is my button command for save. need help in getting this to work, will be getting this to defend for tomorrow school project. Thanks! Its for Datagridview, access, c#. I use 2010VS and MS Access 2007. private void save_Click(object sender, EventArgs e) { if (adminyes.Checked == true || adminno.Checked == true && textBox1.Text != null && textBox2.Text != null && textBox3.Text != null) { admin = "Yes"; if (mode == "a") { x = 0; connect.Close(); connect.ConnectionString = inventorydb;

c# binding datagridview to datatable in form vs control

别说谁变了你拦得住时间么 提交于 2020-01-24 15:30:16
问题 I have the following code: DataGridView lGrid = new DataGridView(); BindingSource _bind = new BindingSource(); DataTable Table = new DataTable(); this.Controls.Add(lGrid); lGrid.AutoGenerateColumns = true; List<string> ColumnsNames = new List<string>(); ColumnsNames.Add("ID"); ColumnsNames.Add("NAME"); foreach (string Name in ColumnsNames) Table.Columns.Add(Name); DataColumn col = Table.Columns["ID"]; DataColumn[] keys = new DataColumn[1]; keys[0] = Table.Columns["ID"]; Table.PrimaryKey =

c# binding datagridview to datatable in form vs control

扶醉桌前 提交于 2020-01-24 15:29:04
问题 I have the following code: DataGridView lGrid = new DataGridView(); BindingSource _bind = new BindingSource(); DataTable Table = new DataTable(); this.Controls.Add(lGrid); lGrid.AutoGenerateColumns = true; List<string> ColumnsNames = new List<string>(); ColumnsNames.Add("ID"); ColumnsNames.Add("NAME"); foreach (string Name in ColumnsNames) Table.Columns.Add(Name); DataColumn col = Table.Columns["ID"]; DataColumn[] keys = new DataColumn[1]; keys[0] = Table.Columns["ID"]; Table.PrimaryKey =