Excel Connection
Excel Connection
Excel Connection
Excel Connection
Excel Connection
Excel Connection Excel Connection Excel Connection Excel Connection Excel Connection Excel Connection Excel Connection Excel Connection
Excel Connection Excel Connection
Excel Connection
Go Back  Xtreme Visual Basic Talk > > > Excel Connection


Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2009, 12:31 AM
aareynaga aareynaga is offline
Newcomer
 
Join Date: Aug 2009
Posts: 1
Question Excel Connection


Hi Guys,

First post and just want to start off by telling you about myself
I'm a BEGINNER in VB and the only experience i have is with ACCESS VBA.
Im using VB 2008 Express and i was wondering if you guys could help me out.
I wanted to know if there was a way to have an excel file be my datasource for a visual basic form?

My idea is this.

I have a form that has a drop down box the box i would like to be populated from excel then when the user selects their choise two other field boxes would be populated...


Any sugegstions, points in the right dirrection, anything would help

Sorry if a question like this was asked before i searched the forums and google but couldnt make heads or tails of it...thanks in advance
Reply With Quote
  #2  
Old 08-31-2009, 05:59 PM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hi aareynaga,

Welcome to the forum.

There are two ways to go about this. Since you have experience with Access, you'll probably be most comfortable using Excel as a data source using ADO.NET, which can be queried using SQL syntax. Your data in this case has to be set up like a data table, with headers across the top, and the data in a block below the headers.

Some sources on extracting data from an Excel workbook via ADO.NET:

For Excel 2003 and below:

Is it viable to use VB.net to display Excel 's data? (DennisW)

For Excel 2007 and above:

HOWTO: Transfer Excel '07 data to SQL Server 2005 EE with ADO.NET (XL-Dennis)

To write data to an Excel workbook using ADO.NET, see:

Sample UPDATE sql command for Excel data source (vb.net-informations.com)

By using ADO.NET, the workbook is queried, but an Excel application is never actually opened.

The other way to go would be to utilize automation, in which case an Excel application instance is created, which your code can directly control. (The application instance can be kept hidden, however, if you do not wish the user to be able to see it while your .NET application is running.)

For the basics on this, I would see the Automating Office Programs with VB.NET tutorial.

I hope this helps get you going, aareynaga. Let us know if there is anything else we can do to help...

Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb

Last edited by Mike Rosenblum; 08-31-2009 at 06:04 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Excel Connection
Excel Connection
Excel Connection Excel Connection
Excel Connection
Excel Connection
Excel Connection Excel Connection Excel Connection Excel Connection Excel Connection Excel Connection Excel Connection
Excel Connection
Excel Connection
 
Excel Connection
Excel Connection
 
-->