Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6588785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:05:28+00:00 2026-05-25T17:05:28+00:00

I am using vb.net. I have following weird problems: If I comment DGVCusClient.Rows.Add(), the

  • 0

I am using vb.net. I have following weird problems:
If I comment DGVCusClient.Rows.Add(), the cell in (“column1”,0) does not display data. But in debug, I can see that the first cell has data assigned.
If I do not comment DGVCusClient.Rows.Add(), the cell in (“column1”,0) displays its data correctly. However, it adds the row on the top for the first time. Except for the first row, it adds rows to the bottom as usual.

                Dim i As Integer = DGVCusClient.CurrentRow.Index
    If Not ContainRecord(tempCusid, tempCltid) Then
        Dim i As Integer = DGVCusClient.CurrentRow.Index

        DGVCusClient.Item("Column1", i).Value = "a"
        DGVCusClient.Item("Column2", i).Value = "b"
                         'DGVCusClient.Rows.Add()

    End If

Private Function ContainRecord(ByVal strCusid As String, ByVal strCltid As String) As Boolean
    For i As Integer = 0 To DGVCusClient.Rows.Count - 1
        If Not DGVCusClient.Item("Column1", i).Value Is Nothing AndAlso Not DGVCusClient.Item("Column2", i).Value Is Nothing Then
            If DGVCusClient.Item("Column1", i).Value.ToString = strCusid AndAlso DGVCusClient.Item("Column2", i).Value.ToString = strCltid Then
                Return True
            End If
        End If
    Next

    Return False
End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:05:28+00:00Added an answer on May 25, 2026 at 5:05 pm

    The following code can always add rows to the bottom, which is what I want. So I just need to first add new row, and then set values to current cells.

    If Not ContainRecord("a", "b") Then
    Dim i As Integer = DGVCusClient.CurrentRow.Index
    DGVCusClient.Rows.Add()
    DGVCusClient.Item("Column1", i).Value = "a"   
    DGVCusClient.Item("Column2", i).Value = "b" 
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the following steps: (I have checked this similar post , which does not
When using ASP.net webforms my usual solution would have following type of setup -
sending mail along with embedded image using asp.net I have already used following but
I am using ASP.NET 3.5 with iTextSharp and I have the following code: var
I am using VB.NET with LINQ to MS SQL. I have two following tables.
If I have the following block of code in a method (using .NET 4
Using .NET regular expressions. Let's say I have the following text: ddddddddddd And I
I have the following extension method (which is invalid and does not compile ATM):
I'm using .NET 3.5, MVC 2 and T4MVC 2.6.42... I have the following action:
So I have the following setup: a VB6 Application using a .NET dll on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.