Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: Task Parrallel Pin
Richard Deeming18-Dec-14 1:34
mveRichard Deeming18-Dec-14 1:34 
GeneralRe: Task Parrallel Pin
Agent__00718-Dec-14 16:21
professionalAgent__00718-Dec-14 16:21 
Questionc# & OAuth2.0 & Google Calendar API v3 Pin
eli123317-Dec-14 12:59
eli123317-Dec-14 12:59 
QuestionHow can I add rows in datagridview in VS? Pin
turbosupramk317-Dec-14 4:28
turbosupramk317-Dec-14 4:28 
GeneralRe: How can I add rows in datagridview in VS? Pin
PIEBALDconsult17-Dec-14 4:34
mvePIEBALDconsult17-Dec-14 4:34 
GeneralRe: How can I add rows in datagridview in VS? Pin
turbosupramk317-Dec-14 4:40
turbosupramk317-Dec-14 4:40 
GeneralRe: How can I add rows in datagridview in VS? Pin
OriginalGriff17-Dec-14 5:20
mveOriginalGriff17-Dec-14 5:20 
GeneralRe: How can I add rows in datagridview in VS? Pin
turbosupramk317-Dec-14 5:29
turbosupramk317-Dec-14 5:29 
Thank you.

I cannot get anything to work to add the code at runtime, besides having a button click add row by row (which I do not want and cannot use) so somehow I've done something in the beginning to break it in trying to figure this out, and now that I've asked for help and gotten working examples, it is thwarting my ability to get it to work properly.

Even the code from the msdn site isn't working and my data grid is indeed called dataGridView1?


[code]
private void Form1_Load(object sender, EventArgs e)
{
InitializeDataGridView();
}

private void InitializeDataGridView()
{
// Create an unbound DataGridView by declaring a column count.
dataGridView1.ColumnCount = 4;
dataGridView1.ColumnHeadersVisible = true;

// Set the column header style.
DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();

columnHeaderStyle.BackColor = Color.Beige;
columnHeaderStyle.Font = new Font("Verdana", 10, FontStyle.Bold);
dataGridView1.ColumnHeadersDefaultCellStyle = columnHeaderStyle;

// Set the column header names.
dataGridView1.Columns[0].Name = "Recipe";
dataGridView1.Columns[1].Name = "Category";
dataGridView1.Columns[2].Name = "Main Ingredients";
dataGridView1.Columns[3].Name = "Rating";

// Populate the rows.
string[] row1 = new string[] { "Meatloaf", "Main Dish", "ground beef",
"**" };
string[] row2 = new string[] { "Key Lime Pie", "Dessert",
"lime juice, evaporated milk", "****" };
string[] row3 = new string[] { "Orange-Salsa Pork Chops", "Main Dish",
"pork chops, salsa, orange juice", "****" };
string[] row4 = new string[] { "Black Bean and Rice Salad", "Salad",
"black beans, brown rice", "****" };
string[] row5 = new string[] { "Chocolate Cheesecake", "Dessert",
"cream cheese", "***" };
string[] row6 = new string[] { "Black Bean Dip", "Appetizer",
"black beans, sour cream", "***" };
object[] rows = new object[] { row1, row2, row3, row4, row5, row6 };

foreach (string[] rowArray in rows)
{
dataGridView1.Rows.Add(rowArray);
}
}
[/code]
GeneralRe: How can I add rows in datagridview in VS? Pin
turbosupramk317-Dec-14 5:48
turbosupramk317-Dec-14 5:48 
GeneralRe: How can I add rows in datagridview in VS? Pin
OriginalGriff17-Dec-14 6:00
mveOriginalGriff17-Dec-14 6:00 
GeneralRe: How can I add rows in datagridview in VS? Pin
turbosupramk317-Dec-14 6:17
turbosupramk317-Dec-14 6:17 
GeneralRe: How can I add rows in datagridview in VS? Pin
OriginalGriff17-Dec-14 6:24
mveOriginalGriff17-Dec-14 6:24 
GeneralRe: How can I add rows in datagridview in VS? Pin
turbosupramk317-Dec-14 7:02
turbosupramk317-Dec-14 7:02 
Questionhow to divide an image and find the center of each part by c# Pin
Member 1131709316-Dec-14 23:05
Member 1131709316-Dec-14 23:05 
AnswerRe: how to divide an image and find the center of each part by c# Pin
Simon_Whale16-Dec-14 23:23
Simon_Whale16-Dec-14 23:23 
GeneralRe: how to divide an image and find the center of each part by c# Pin
Member 1131709318-Dec-14 22:48
Member 1131709318-Dec-14 22:48 
GeneralRe: how to divide an image and find the center of each part by c# Pin
Member 1131709320-Dec-14 6:49
Member 1131709320-Dec-14 6:49 
GeneralRe: how to divide an image and find the center of each part by c# Pin
BillWoodruff2-Jan-15 5:19
professionalBillWoodruff2-Jan-15 5:19 
Questionvalidation for 10 digit phone number Pin
Jinxez16-Dec-14 19:11
Jinxez16-Dec-14 19:11 
AnswerRe: validation for 10 digit phone number Pin
V.16-Dec-14 19:24
professionalV.16-Dec-14 19:24 
AnswerRe: validation for 10 digit phone number Pin
Agent__00716-Dec-14 22:01
professionalAgent__00716-Dec-14 22:01 
AnswerRe: validation for 10 digit phone number Pin
OriginalGriff16-Dec-14 22:40
mveOriginalGriff16-Dec-14 22:40 
GeneralRe: validation for 10 digit phone number Pin
Richard Deeming17-Dec-14 2:19
mveRichard Deeming17-Dec-14 2:19 
GeneralRe: validation for 10 digit phone number Pin
_Maxxx_17-Dec-14 18:22
professional_Maxxx_17-Dec-14 18:22 
GeneralRe: validation for 10 digit phone number Pin
PIEBALDconsult17-Dec-14 3:23
mvePIEBALDconsult17-Dec-14 3:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.