Click here to Skip to main content
15,905,508 members
Home / Discussions / C#
   

C#

 
QuestionStreamReader in TcpListener Pin
Member 114922552-Mar-15 7:14
Member 114922552-Mar-15 7:14 
AnswerRe: StreamReader in TcpListener Pin
Paulo Zemek2-Mar-15 7:45
Paulo Zemek2-Mar-15 7:45 
GeneralRe: StreamReader in TcpListener Pin
Member 114922552-Mar-15 8:25
Member 114922552-Mar-15 8:25 
QuestionDatagridview row replay Pin
sdfsdfsdfewrew3feff1-Mar-15 5:03
sdfsdfsdfewrew3feff1-Mar-15 5:03 
GeneralRe: Datagridview row replay Pin
Richard MacCutchan1-Mar-15 6:15
mveRichard MacCutchan1-Mar-15 6:15 
GeneralRe: Datagridview row replay Pin
sdfsdfsdfewrew3feff1-Mar-15 8:23
sdfsdfsdfewrew3feff1-Mar-15 8:23 
GeneralRe: Datagridview row replay Pin
Richard MacCutchan1-Mar-15 22:38
mveRichard MacCutchan1-Mar-15 22:38 
GeneralRe: Datagridview row replay Pin
Eddy Vluggen2-Mar-15 8:02
professionalEddy Vluggen2-Mar-15 8:02 
Questioncreating a generic factory class that handles ValueTypes ? Pin
BillWoodruff28-Feb-15 23:36
professionalBillWoodruff28-Feb-15 23:36 
AnswerRe: creating a generic factory class that handles ValueTypes ? Pin
OriginalGriff1-Mar-15 0:11
mveOriginalGriff1-Mar-15 0:11 
GeneralRe: creating a generic factory class that handles ValueTypes ? Pin
BillWoodruff1-Mar-15 1:23
professionalBillWoodruff1-Mar-15 1:23 
AnswerRe: creating a generic factory class that handles ValueTypes ? Pin
manchanx1-Mar-15 1:53
professionalmanchanx1-Mar-15 1:53 
GeneralRe: creating a generic factory class that handles ValueTypes ? Pin
BillWoodruff1-Mar-15 6:26
professionalBillWoodruff1-Mar-15 6:26 
AnswerRe: creating a generic factory class that handles ValueTypes ? Pin
Richard Deeming2-Mar-15 2:24
mveRichard Deeming2-Mar-15 2:24 
QuestionIs there a way to make "speakers" pickup 440hz? Pin
Member 1148826328-Feb-15 18:13
Member 1148826328-Feb-15 18:13 
AnswerRe: Is there a way to make "speakers" pickup 440hz? Pin
OriginalGriff28-Feb-15 20:05
mveOriginalGriff28-Feb-15 20:05 
AnswerRe: Is there a way to make "speakers" pickup 440hz? Pin
Frankie-C1-Mar-15 1:21
Frankie-C1-Mar-15 1:21 
AnswerRe: Is there a way to make "speakers" pickup 440hz? Pin
GrooverFromHolland1-Mar-15 1:25
GrooverFromHolland1-Mar-15 1:25 
QuestionIs there Any Way to Set the Namespace of a Web Service in Configuration instead of Code? Pin
jojoba2027-Feb-15 22:52
jojoba2027-Feb-15 22:52 
AnswerRe: Is there Any Way to Set the Namespace of a Web Service in Configuration instead of Code? Pin
Dave Kreskowiak28-Feb-15 4:08
mveDave Kreskowiak28-Feb-15 4:08 
AnswerRe: Is there Any Way to Set the Namespace of a Web Service in Configuration instead of Code? Pin
jojoba2028-Feb-15 22:35
jojoba2028-Feb-15 22:35 
QuestionDataGridView Entry Disappears (C#) Pin
Member 1148588827-Feb-15 8:53
Member 1148588827-Feb-15 8:53 
AnswerRe: DataGridView Entry Disappears (C#) Pin
Dave Kreskowiak27-Feb-15 11:26
mveDave Kreskowiak27-Feb-15 11:26 
GeneralRe: DataGridView Entry Disappears (C#) Pin
Member 1148588827-Feb-15 12:08
Member 1148588827-Feb-15 12:08 
GeneralRe: DataGridView Entry Disappears (C#) Pin
Dave Kreskowiak27-Feb-15 13:16
mveDave Kreskowiak27-Feb-15 13:16 
OK, a few things. First, you haven't solved the problem of multiple forms. You've just hidden them and never reusing the them. You're creating a new instance of every form on every button click, even your MAIN FORM!!

You're using the default names for all of your controls. DON'T! I have no idea what "button1" does and, in a years time, neither will you. Always give your controls and variables meaningful names.

If these two button controls on your main form with the grids and just there to get data from the user to add to the grid, you should create an instance of the data entry form and show it with ShowDialog. When the user clicks OK on that form control will return to the line right after the ShowDialog call. You can then get the data from that form, put it in your grids, then Dispose the form.

Next, when you go and clear all the rows from your datagrids, you don't need loops to delete each row from the girds. Look at the documentation for the Rows collection. There's a Clear() method on it. Call that and you wipe out every row in your datagrid in a single line of code.
A guide to posting questions on CodeProject

Click this: Asking questions is a skill.
Seriously, do it.

Dave Kreskowiak

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.