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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:30:23+00:00 2026-05-28T04:30:23+00:00

My Windows Forms app collects data from user input and mathematical calculation and outputs

  • 0

My Windows Forms app collects data from user input and mathematical calculation and outputs a set of results to an Excel spreadsheet.

Here’s my code (for convenience, I’ve included only the code that seems relevant to the problem):

        Dim exc As New Excel.Application
        Dim book As Excel.Workbook
        Dim sheet As Excel.Worksheet

        book = exc.Workbooks.Add
        sheet = book.Sheets.Add

        Dim dc As System.Data.DataColumn
        Dim dr As System.Data.DataRow
        Dim colIndex As Integer = 0
        Dim rowIndex As Integer = 1

        exc.Cells(0, 0) = "Clearspan Cladding Sheet"
        exc.Cells(0, 1) = dtpDate.Value
        exc.Cells(0, 2) = "Job No. " & txtJob.Text
        exc.Cells(0, 3) = "By " & txtName.Text

        For Each dc In dtTotals.Columns
            colIndex = colIndex + 1
            exc.Cells(1, colIndex) = dc.ColumnName
        Next

The error occurs when I try to to Cell(0, 0). Below is the most detailed information I could get on the error. The For...Next loop works (as tested in previous debug sessions). As far as I can see, I’m doing exactly the same thing above it.

System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   at Microsoft.Office.Interop.Excel.Range.set__Default(Object RowIndex, Object ColumnIndex, Object Param)
   at Cladding.frmCladdingMain.Button1_Click(Object sender, EventArgs e) in C:\Users\logan.HO\Documents\Visual Studio 2010\Projects\Clearspan\Cladding\frmCladdingMain.vb:line 240

As always, thanks in advance for any assistance provided.

  • 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-28T04:30:24+00:00Added an answer on May 28, 2026 at 4:30 am

    Check this link: http://support.microsoft.com/kb/301982
    The first row & col value is 1,1 ( i.e. A1 = cell(1,1) ).

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

Sidebar

Related Questions

What's the best way to pass data from one Windows Forms app (an office
In a Windows Forms app I set the ContextMenuStrip property on a TabControl. How
I am from a c# background and am converting a vb.net windows forms app
I inherited a Windows Forms app written in VB.Net. Certain parts of the app
I have a Windows Forms app, that has a single ElementHost containing a WPF
I have a windows forms app with a textbox control that I want to
I have a windows forms app where I have split different functionality into several
I'm coding a Windows Forms App that has a StatusStrip that displays status informations
I have a .NET 2.0 windows forms app, which makes heavy use of the
I am working on a Windows Forms app for quite some time now, and

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.