Get Selected Records from Excel file
In this article we will learn about how can we get records from excel file in c#.
Continue reading “How to get selected records from Excel file in c#”
Get Selected Records from Excel file
In this article we will learn about how can we get records from excel file in c#.
Continue reading “How to get selected records from Excel file in c#”
This article demonstrates how to create an contact in outlook programmatically using visual basic 6.0 through Microsoft Outlook’s object-model.
Continue reading “Creating a new contact in outlook using vb 6”
This article demonstrates how to create an appointment in outlook programmatically using visual basic 6.0 through Microsoft Outlook’s object-model.
This example requires a button control in Standard EXE project in visual basic 6.0, you need an early-bound reference to a Microsoft Outlook type library. Double-click the button, and then add the following code:
Dim oApp As Outlook.Application Set oApp = CreateObject("Outlook.Application") Dim oNs As Outlook.NameSpace Set oNs = olApp.GetNamespace("MAPI") oNs.Logon Dim oAppt As Outlook.AppointmentItem Set oAppt = oApp.CreateItem(olAppointmentItem) oAppt.Start = "12/2/2011 2:20:00 PM" With oAppt .Duration = 60 .Subject = "meeting with Client" .Body = "About Project..." .Location = "Our New York Office" .ReminderSet = True End With oAppt.Save Set oNs = Nothing Set oAppt = Nothing Set oApp = Nothing
How to set an outlook custom form as the default form for a particular folder
If you want to change the default form for any folder except Mail folders, follows these steps:
Continue reading “How to set a outlook custom form as the default form for a particular folder”
You can draw a grid of one-pixel dots with the specified spacing, within the specified bounds, on the specified graphics surface, and in the specified color with the help of ControlPaint.DrawGrid Method using vb.net
You can use ControlPaint.DrawGrid Method like as :
Public Shared Sub DrawGrid ( grp As Graphics,area As Rectangle, _
pixelsBetweenDots As Size, backColor As Color )
Following example draw a grid on windows form:
Private Sub Form1_Paint(ByVal sender As System.Object, _ ByVal e As System.Windows.Forms.PaintEventArgs) _ Handles MyBase.Paint ControlPaint.DrawGrid(e.Graphics, New Rectangle(50, 200, 250, 100), New Size(5, 5), Color.Red) End Sub
Drag and drop operation is the same as cut and paste (or copy and paste) through the mouse instead of the keyboard.
Continue reading “Drag and drop from treeview to textbox in vb.net”
We can use can use the PrintOut method to print a Microsoft Office Word document, following example code shows how to print whole word document in vb.net and c# languages:
[vb.net]
Private Sub PrintWordDocument() Dim objWord As Word.Application Dim objDoc As Word.Document objWord = CreateObject("Word.Application") objDoc = objWord.Documents.Open("D:\Test.docx") objDoc.PrintOut() objDoc.Close() objDoc = Nothing objWord.Quit() End Sub
[c#]
private void PrintWordDocument() { object objMissing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.Application objWord; Microsoft.Office.Interop.Word.Document objDoc; objWord = new Microsoft.Office.Interop.Word.Application(); object fileName = @"D:\Test.docx"; objDoc=objWord.Documents.Open(ref fileName, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing); object copies = "1"; object pages = ""; object range = Microsoft.Office.Interop.Word.WdPrintOutRange.wdPrintAllDocument; object items = Microsoft.Office.Interop.Word.WdPrintOutItem.wdPrintDocumentContent; object pageType = Microsoft.Office.Interop.Word.WdPrintOutPages.wdPrintAllPages; object objTrue = true; object objFalse = false; objDoc.PrintOut( ref objTrue, ref objFalse, ref range, ref objMissing, ref objMissing, ref objMissing, ref items, ref copies, ref pages, ref pageType, ref objFalse, ref objTrue, ref objMissing, ref objFalse, ref objMissing, ref objMissing, ref objMissing, ref objMissing); }
We can use can use the PrintOut method to print a Microsoft Office Word document, following example code shows how to print one copy of the current page of the word document in vb.net and c# languages:
[vb.net]
Private Sub PrintCurrentpageInWordDocument() Dim objWord As Word.Application Dim objDoc As Word.Document objWord = CreateObject("Word.Application") objDoc = objWord.Documents.Open("D:\Test.docx") objDoc.PrintOut(Background:=True, Append:=False, _ Range:=Word.WdPrintOutRange.wdPrintCurrentPage, _ Item:=Word.WdPrintOutItem.wdPrintDocumentContent, _ Copies:="1", Pages:="1", PageType:=Word.WdPrintOutPages.wdPrintAllPages, _ PrintToFile:=False, Collate:=True, ManualDuplexPrint:=False) objDoc.Close() objDoc = Nothing objWord.Quit() End Sub
[c#]
private void PrintCurrentpageInWordDocument() { object objMissing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.Application objWord; Microsoft.Office.Interop.Word.Document objDoc; objWord = new Microsoft.Office.Interop.Word.Application(); object fileName = @"D:\Test.docx"; objDoc=objWord.Documents.Open(ref fileName, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing); object copies = "1"; object pages = "1"; object range = Microsoft.Office.Interop.Word.WdPrintOutRange.wdPrintCurrentPage; object items = Microsoft.Office.Interop.Word.WdPrintOutItem.wdPrintDocumentContent; object pageType = Microsoft.Office.Interop.Word.WdPrintOutPages.wdPrintAllPages; object objTrue = true; object objFalse = false; objDoc.PrintOut( ref objTrue, ref objFalse, ref range, ref objMissing, ref objMissing, ref objMissing, ref items, ref copies, ref pages, ref pageType, ref objFalse, ref objTrue, ref objMissing, ref objFalse, ref objMissing, ref objMissing, ref objMissing, ref objMissing); }
This example shows how to create an e-mail message in Outlook.
Private Sub CreateMailItem() Dim objItem As Outlook.MailItem = _ Me.CreateItem(Outlook.OlItemType.olMailItem) objItem.Subject = "Hello Author" objItem.To = "aboutus@authorcode.com" objItem.Body = "Hello Author, i want to contact you" objItem.Importance = Outlook.OlImportance.olImportanceLow objItem.Display(False) End Sub
This example shows how to open an existing word document in c# programming language.
Add reference of ‘Microsoft.Office.Interop.Word’ in your project.
This code example requires a document named Test.docx must exist in a D: drive.
private void OpenWordDocument() { object objMissing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word._Application objWord; Microsoft.Office.Interop.Word._Document objDoc; objWord = new Microsoft.Office.Interop.Word.Application(); object fileName = @"D:\Test.docx"; objDoc=objWord.Documents.Open(ref fileName, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing); }