ads

Wednesday, April 30, 2008

Picture / Image Loader sample in C#

Screenshot
[Controls to use]
PictureBox
Command Button
Dialog Box
Textbox
------------------------------------
[Source Code]

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

DialogResult dRslt;
FileDLG.Filter = "JPEG Picture File(*.JpEg)|*.jpg|Windows Bitmap File(*.BMP)|*.bmp";
dRslt = FileDLG.ShowDialog();
textBox1.Text = FileDLG.FileName.ToString ();
}

private void FileDLG_FileOk(object sender, CancelEventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Load(FileDLG.FileName.ToString());
}
}
}

Wednesday, April 16, 2008

VB.NET Office Automation FAQ

I saw this article on a forum, i think it is a very useful article regarding Office Automation

This FAQ 101 is a listing of handy links for getting started with .NET Automation/Interoperation of Microsoft Office programs such as Excel, Word, Access or Outlook.

The first place to start learning about how to integrate MS Office programs into your .NET application is the tutorial Automating Office Programs with VB.NET. It discusses what you need to know to get started, as well as addressing some of the difficulties with .NET Automation such as execution speed and deployment issues. If you are new to .NET Interoperation/Automation, then this link is a good place for you to begin.

For articles on how to fully utilize the Excel object model, Word, and Outlook please check out the following links:

(1) Understanding the Excel Object Model from a .NET Developer's Perspective
(2) Understanding the Word Object Model from a .NET Developer's Perspective
(3) Programming Microsoft Outlook with Visual Studio .NET

(We still lack a resource for utilizing the Access object model in .NET, so if someone knows of a good source, please send me a private message and we will be glad to add it.)

Some advanced forums on MS Office programming include:

(1) .NET Office Automation (XVBT)
(2) Visual Studio Tools for Office Forum (MSDN)
(3) COM Add-ins Forum (MSDN)
(4) Interoperation / Office Integration (XDNT)

Microsoft Office Programs are still COM ActiveX Servers, so the best help regarding specific commands or techniques can be often found in the VBA Forums. If your question is .NET-specific, please place your question in the .NET Office Automation forum. But if your question regards the Microsoft Office object model, as called from VBA or Visual Basic 6.0, then the following VBA/VB6 Office Integration forums can be your best bet:

(1) VBA / Office Integration forum (XVBT)
(2) Excel VBA forum (XVBT)

For some general articles regarding MS Office Interoperation from your .NET application, see the following links:

(1) Automating Office Programs with VB.NET
(2) Creating Office Managed COM Add-Ins with Visual Studio .NET
(3) HOWTO: Run Office Macros by Using Automation from Visual Basic
(4) Develop Microsoft Office Solutions with Visual Studio .NET

For articles dealing with execution or deployment issues and problems:

(1) Office Application Does Not Quit After Automation from VS.NET Client
(2) Microsoft Office XP PIAs Are Available for Download
(3) Office XP Primary Interop Assemblies Known Issues

Google Search