Click here to Skip to main content
15,943,560 members
Home / Discussions / Windows Forms
   

Windows Forms

 
PinnedForum Guidelines - PLEASE READ PinPopular
Chris Maunder28-Jul-09 2:38
cofounderChris Maunder28-Jul-09 2:38 
QuestionCoral 2.2.2 not work Pin
Kasza Norbert20-Jun-24 7:49
Kasza Norbert20-Jun-24 7:49 
AnswerRe: Coral 2.2.2 not work Pin
Sean Ewington20-Jun-24 9:13
staffSean Ewington20-Jun-24 9:13 
GeneralRe: Coral 2.2.2 not work Pin
Kasza Norbert20-Jun-24 21:13
Kasza Norbert20-Jun-24 21:13 
QuestionHow to install all nugets from certain publishers in the package manager without install one by one ? Pin
Martin Adams 202314-May-24 14:49
Martin Adams 202314-May-24 14:49 
AnswerRe: How to install all nugets from certain publishers in the package manager without install one by one ? Pin
Dave Kreskowiak14-May-24 16:12
mveDave Kreskowiak14-May-24 16:12 
GeneralRe: How to install all nugets from certain publishers in the package manager without install one by one ? Pin
Martin Adams 202315-May-24 1:27
Martin Adams 202315-May-24 1:27 
QuestionAny solution for this error: Timed out while connecting to named pipe.? Pin
Martin Adams 202314-May-24 10:52
Martin Adams 202314-May-24 10:52 
SuggestionRe: Any solution for this error: Timed out while connecting to named pipe.? Pin
Maciej Los14-May-24 11:02
mveMaciej Los14-May-24 11:02 
AnswerRe: Any solution for this error: Timed out while connecting to named pipe.? Pin
Dave Kreskowiak14-May-24 11:04
mveDave Kreskowiak14-May-24 11:04 
GeneralRe: Any solution for this error: Timed out while connecting to named pipe.? Pin
Martin Adams 202314-May-24 11:18
Martin Adams 202314-May-24 11:18 
GeneralRe: Any solution for this error: Timed out while connecting to named pipe.? Pin
Martin Adams 202314-May-24 11:32
Martin Adams 202314-May-24 11:32 
QuestionCode-Behind in Designer.cs File [SOLVED] Pin
Richard Andrew x648-Jul-23 6:30
professionalRichard Andrew x648-Jul-23 6:30 
AnswerRe: Code-Behind in Designer.cs File [SOLVED] Pin
Andre Oosthuizen9-Jul-23 3:50
mveAndre Oosthuizen9-Jul-23 3:50 
Questionclosing serialport1 form 1 and form 2 Pin
geomeo12323-Mar-23 13:58
geomeo12323-Mar-23 13:58 
AnswerRe: closing serialport1 form 1 and form 2 Pin
Graeme_Grant23-Mar-23 15:10
mvaGraeme_Grant23-Mar-23 15:10 
GeneralRe: closing serialport1 form 1 and form 2 Pin
geomeo12323-Mar-23 16:10
geomeo12323-Mar-23 16:10 
GeneralRe: closing serialport1 form 1 and form 2 Pin
Graeme_Grant23-Mar-23 16:22
mvaGraeme_Grant23-Mar-23 16:22 
Questionchange new form in winforms process running by user Pin
Member 1235220616-Jan-23 2:02
Member 1235220616-Jan-23 2:02 
AnswerRe: change new form in winforms process running by user Pin
Dave Kreskowiak16-Jan-23 13:44
mveDave Kreskowiak16-Jan-23 13:44 
GeneralRe: change new form in winforms process running by user Pin
Member 1235220620-Jan-23 11:09
Member 1235220620-Jan-23 11:09 
Questionadd new row if not exist row in datagirdview1 Pin
Sufvan Adil 202315-Jan-23 15:25
Sufvan Adil 202315-Jan-23 15:25 
AnswerRe: add new row if not exist row in datagirdview1 Pin
Richard MacCutchan15-Jan-23 22:01
mveRichard MacCutchan15-Jan-23 22:01 
AnswerRe: add new row if not exist row in datagirdview1 Pin
Richard Deeming15-Jan-23 22:33
mveRichard Deeming15-Jan-23 22:33 
Sufvan Adil 2023 wrote:
VB.NET
If DataGridView1.Rows.Count - 1 Then
Thanks to VB's "evil type coercion", that condition will be False if you have precisely one row in your grid. For any other number of rows, that condition will be True.
Sufvan Adil 2023 wrote:
VB.NET
For i = 0 To DataGridView1.Rows.Count - 1
    If DataGridView1.Rows(i).Cells("d1alisname").Value = "" Then
        Exit Sub
    Else
        DataGridView1.Rows.Add()
    End If
Next
That code walks through all the rows in your grid until it finds one where the d1alisname column is blank. For every row that it encounters where that column is not blank, it adds a new row.

You haven't explained exactly what you're trying to do. At a guess, you want to add a new row if there are either no rows in the grid, or all of the rows have a value in the d1alisname column. In which case, you need to move the "add row" code after your For loop from your second code block:
VB.NET
For i = 0 To DataGridView1.Rows.Count - 1
    If DataGridView1.Rows(i).Cells("d1alisname").Value = "" Then
        Exit Sub
    End If
Next

DataGridView1.Rows.Add()




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

Questionvb.net chart axis.X only every 5th Label should be shown. Pin
JTrum9-May-22 4:11
JTrum9-May-22 4:11 

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.