Click here to Skip to main content
16,016,562 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Read and write (propertygrid values) from xml file Pin
Vanamaindia1-Oct-07 1:42
Vanamaindia1-Oct-07 1:42 
Questiondisplaying playtime Pin
bhattiprolu28-Sep-07 20:22
bhattiprolu28-Sep-07 20:22 
AnswerRe: displaying playtime Pin
Christian Graus29-Sep-07 0:25
protectorChristian Graus29-Sep-07 0:25 
AnswerRe: displaying playtime Pin
LloydA11129-Sep-07 1:13
LloydA11129-Sep-07 1:13 
GeneralRe: displaying playtime Pin
Christian Graus29-Sep-07 1:27
protectorChristian Graus29-Sep-07 1:27 
QuestionHyperlink Pin
hsuresh28-Sep-07 19:42
hsuresh28-Sep-07 19:42 
AnswerRe: Hyperlink Pin
Christian Graus29-Sep-07 1:28
protectorChristian Graus29-Sep-07 1:28 
Questionhow to transfer the text box values etc from a registration page to an excel sheet in vb.net Pin
chiyankrishna28-Sep-07 18:33
chiyankrishna28-Sep-07 18:33 
hi guys.

i would like to know how to transfer or export the values of a registration page to an excel sheet through vb.net.

i have done something in this but of no use.

i have refferenced the microsoft excel 11.0 library to the project. when i was mentioning the class name ie imports microsoft.office.interop.. the last part ie the interop was not comming instead of that '.core' was there and was unable to create a excel worksheet from my application .


i will post here my code. please review it and tell me about any changes.


imports microsoft.office.core // unable to get the interop here

Dim oExcel As Excel.Application

Dim oBook, oBook1 As Excel.Workbook

Dim oSheet As Excel.Worksheet

'Start a new workbook in Excel.

oExcel = New Excel.Application

oBook = oExcel.Workbooks.Add

oBook1 = oExcel.Workbooks.Add

'Add data to cells of the first worksheet in the new workbook.

oSheet = CType(oBook.Worksheets(1), Excel.Worksheet)

'Response.Clear()
'Response.Buffer = True
'Response.ContentType = "application/msword"
''Response.ContentType = "application/vnd.ms-excel"
'Dim stringWrite As New System.IO.StringWriter
'Dim htmlTextWriter As HtmlTextWriter = New HtmlTextWriter(stringWrite)
'txtPwd.RenderControl(htmlTextWriter)

'Response.Write(stringWrite.ToString())
'Response.End()

'Dim myexcel As Excel.Application
'Dim oExcel As Object
'Dim oBook As Object
'Dim wbook As Excel.Workbook
'Dim wsheet As Excel.Application
'Dim oSheet As Object
'Dim strCust As String


''Start a new workbook in Excel.
'oExcel = CreateObject("wsheet")
'oBook = oExcel.Workbooks.Add

''Add data to cells of the first worksheet in the new workbook.
'oSheet = oBook.Worksheets(1)

''send Label to cells
oSheet.Range("A1").Value = Label12.Text
oSheet.Range("B1").Value = Label3.Text
oSheet.Range("C1").Value = Label4.Text
oSheet.Range("D1").Value = Label5.Text
oSheet.Range("E1").Value = Label6.Text
oSheet.Range("F1").Value = Label7.Text
'oSheet.Range("G1").Value = lblDiscountAmount.Text
'oSheet.Range("H2").Value = lblDiscount.Text
'oSheet.Range("I1").Value = lblInvoiceTotal.Text

'Format cell dimension
oSheet.Columns("A:A").ColumnWidth = 18
oSheet.Columns("B:B").ColumnWidth = 30
oSheet.Columns("C:C").ColumnWidth = 20
oSheet.Columns("DBig Grin | :-D ").ColumnWidth = 10
oSheet.Columns("F:F").ColumnWidth = 10
oSheet.Columns("G:G").ColumnWidth = 16
oSheet.Columns("H:H").ColumnWidth = 12
oSheet.Columns("I:I").ColumnWidth = 12


'Formating label to cell
oSheet.Range("A1:B1:C1:D1:E1:F1:G1:H1:I1").Font.Bold = True
oSheet.Range("G2:H2:I2").Font.Bold = True
oSheet.Range("G1:I1").Font.ColorIndex = 3
oSheet.Range("I2").Interior.ColorIndex = 6
oSheet.Range("G2").Interior.ColorIndex = 36
oSheet.Range("F2").Interior.ColorIndex = 36

'send data from textboxes to cells in excel
oSheet.Range("A2").Value = txtPwd.Text
oSheet.Range("B2").Value = txtConform.Text
oSheet.Range("C2").Value = txtFname.Text
oSheet.Range("D2").Value = txtMname.Text
oSheet.Range("E2").Value = txtLname.Text
oSheet.Range("F2").Value = ddlGender.SelectedItem()
'oSheet.Range("G2").Value = txtDiscountAmount.Text
'oSheet.Range("I2").Value = txtInvoiceTotal.Text

'Save the Workbook and quit Excel.

oSheet = Nothing
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
GC.Collect()


there is no such thing as good or bad.

AnswerRe: how to transfer the text box values etc from a registration page to an excel sheet in vb.net Pin
Andy_L_J28-Sep-07 19:13
Andy_L_J28-Sep-07 19:13 
QuestionHiding Panels in VB.NET Pin
AAGTHosting28-Sep-07 12:22
AAGTHosting28-Sep-07 12:22 
AnswerRe: Hiding Panels in VB.NET Pin
Christian Graus28-Sep-07 13:30
protectorChristian Graus28-Sep-07 13:30 
QuestionWindows application in Vb.NET Pin
Senthil K Ramadoss28-Sep-07 12:09
Senthil K Ramadoss28-Sep-07 12:09 
AnswerRe: Windows application in Vb.NET Pin
Christian Graus28-Sep-07 13:35
protectorChristian Graus28-Sep-07 13:35 
AnswerRe: Windows application in Vb.NET Pin
GuyThiebaut28-Sep-07 22:06
professionalGuyThiebaut28-Sep-07 22:06 
AnswerRe: Windows application in Vb.NET Pin
LloydA11129-Sep-07 1:31
LloydA11129-Sep-07 1:31 
QuestionWindows application in Vb.NET Pin
Senthil K Ramadoss28-Sep-07 12:08
Senthil K Ramadoss28-Sep-07 12:08 
AnswerRe: Windows application in Vb.NET Pin
Johan Hakkesteegt29-Sep-07 7:54
Johan Hakkesteegt29-Sep-07 7:54 
AnswerRe: Windows application in Vb.NET Pin
Vimalsoft(Pty) Ltd1-Oct-07 5:45
professionalVimalsoft(Pty) Ltd1-Oct-07 5:45 
Questionproblems with radio buttons Pin
zamzoum28-Sep-07 11:01
zamzoum28-Sep-07 11:01 
AnswerRe: problems with radio buttons Pin
Dave Kreskowiak28-Sep-07 12:29
mveDave Kreskowiak28-Sep-07 12:29 
QuestionRe: problems with radio buttons Pin
zamzoum29-Sep-07 11:11
zamzoum29-Sep-07 11:11 
AnswerRe: problems with radio buttons Pin
Johan Hakkesteegt29-Sep-07 8:05
Johan Hakkesteegt29-Sep-07 8:05 
GeneralRe: problems with radio buttons Pin
Dave Kreskowiak29-Sep-07 8:23
mveDave Kreskowiak29-Sep-07 8:23 
GeneralRe: problems with radio buttons Pin
Johan Hakkesteegt30-Sep-07 21:05
Johan Hakkesteegt30-Sep-07 21:05 
GeneralRe: problems with radio buttons Pin
Dave Kreskowiak1-Oct-07 1:01
mveDave Kreskowiak1-Oct-07 1:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.