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 8766923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:40:21+00:00 2026-06-13T16:40:21+00:00

Can you help me with this.. For Each r As DataGridViewRow In dglist.Rows For

  • 0

Can you help me with this..

   For Each r As DataGridViewRow In dglist.Rows
        For Each c As DataGridViewCell In r.Cells
            If c.Value IsNot Nothing Then
                **If c.Value.ToString = Label2.Text.ToString Then
                    c.Value.ToString.Trim.Replace(c.Value.ToString.Trim, TextBox1.Text)
                End If**

                'MessageBox.Show(c.Value.ToString)
            End If
        Next
    Next

I need to replace the value of the cell with the value of the label.
But still my code did not work.

  • 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-06-13T16:40:22+00:00Added an answer on June 13, 2026 at 4:40 pm

    You need to assign the value (to cell value property) rather than operate on the value of string you have. When you do an operation like ToString etc an additional instance in memory is created and that’s all if you are not assigning it. Do this instead:

     For Each r As DataGridViewRow In dglist.Rows
            For Each c As DataGridViewCell In r.Cells
                If c.Value IsNot Nothing Then
                    **If c.Value.ToString = Label2.Text Then
                        c.Value = TextBox1.Text
                    End If**
    
                    'MessageBox.Show(c.Value.ToString)
                End If
            Next
        Next
    

    Reconsider your if clauses since I am not very sure that’s what you are looking for. In your question you say you want to assign the value of label, but in the code you pasted it seemed to me that you are after text value of your text box.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure if yall can help this time, as I'm just using this particular
Can anyone help - this is driving me mad. I am calling a mysql
I'm hoping someone can help on this one, I have created a custom object
http://jsfiddle.net/YaMhn/8/ ^^^^Take a look and see if you can help solve this Ok so
Can anyone help with this... vector<unsigned int> *vVec = new vector<unsigned int>; vVec .reserve(frankReservedSpace);
Can anyone help convert this this actionscript to Objective-c? if(mcMain.y >= stage.stageHeight - mcMain.height)
can someone help with this? I need the following function to do this... $x
Can anyone help in this php page navigation script switch on counting normal serial
Can anybody help with this code I just don't know where I am going
Perhaps you can help me find this in the docs. I'm using pound-quote to

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.