dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Excel Interop Help

  1. #1
    Join Date
    Jan 2019
    Posts
    3

    Excel Interop Help

    Hey All,

    I am having an issue returning an entire row of data rather then an individual cell. What am I doing wrong?

    For i As Integer = 2 To counta
    If CStr(xlWorkSheet2.Cells(i, 21).value) = Form3.Label1.Text Then
    t1 = CStr(xlWorkSheet2.Cells(i, xlWorkSheet2.Range(i).EntireRow).Value)
    xlWorkSheet2.
    Form3.DataGridView1.Rows.Add(t1)
    TextBox2.Text = "Row " & i
    ProgressBar1.Value = ProgressBar1.Value + 1
    Else
    ProgressBar1.Value = ProgressBar1.Value + 1
    End If
    Next
    Is there a way to return an entire row of data instead of just a cell?

    Thanks!
    Last edited by k7s41gx; January 11th, 2019 at 01:18 PM. Reason: formatting

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,891

    Re: Excel Interop Help

    Looks like the row you add only has one column (i.e. cell). I don't see code where you try to read.

    Can you open an excell file and read the rows (search google for an example)? Try this to figure out if the issue is with how you add the row rather than reading a row.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)