Click here to Skip to main content
15,911,786 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRe: Hotel reservation Pin
Smithers-Jones17-Dec-08 23:32
Smithers-Jones17-Dec-08 23:32 
AnswerRe: Hotel reservation Pin
Jay Royall17-Dec-08 23:46
Jay Royall17-Dec-08 23:46 
AnswerRe: Hotel reservation Pin
Christian Graus17-Dec-08 23:57
protectorChristian Graus17-Dec-08 23:57 
AnswerRe: Hotel reservation Pin
Nanda_MR17-Dec-08 23:58
Nanda_MR17-Dec-08 23:58 
GeneralRe: Hotel reservation Pin
Christian Graus18-Dec-08 0:02
protectorChristian Graus18-Dec-08 0:02 
GeneralRe: Hotel reservation Pin
Nanda_MR18-Dec-08 0:23
Nanda_MR18-Dec-08 0:23 
GeneralRe: Hotel reservation Pin
LloydA11119-Dec-08 8:44
LloydA11119-Dec-08 8:44 
QuestionCreating Excel data class Pin
SangGi Hwang17-Dec-08 22:17
SangGi Hwang17-Dec-08 22:17 
Hi,
I am a beginner of VB2008 programming.
I tried to develop a simple class which takes array data and write them in Excel sheet as 2D array. However, it is not working. Could anyone tell me what went wrong? Here is my code.
Public Class WriteDtToExcel
Private ShNumber As Integer
Private CellX As Integer
Private CellY As Integer
Private ReadOnly DtA(CellX * CellY) As Double
Public Property SheetNumber() As Integer
Get
Return ShNumber
End Get
Set(ByVal value As Integer)
ShNumber = value
End Set
End Property
Public Property XSize() As Integer
Get
Return CellX
End Get
Set(ByVal value As Integer)
CellX = value
End Set
End Property
Public Property YSize() As Integer
Get
Return CellY
End Get
Set(ByVal value As Integer)
CellY = value
End Set
End Property

Public Sub New()
Dim i As Integer
For i = 0 To DtA.Length
DtA(i) = DtA.Length - i - 1
Next
End Sub

Public ReadOnly Property ArrayData() As Double()
Get
Return DtA
End Get
End Property

Sub WriteDtToExcel()
Dim objApp As Excel.Application
Dim objBook As Excel.Workbook
Dim objBooks As Excel.Workbooks
Dim objSheets As Excel.Sheets
Dim objSheet As Excel._Worksheet
Dim range As Excel.Range
Dim x As Integer
Dim y As Integer
' Create a new instance of Excel and start a new workbook.
objApp = New Excel.Application()
objBooks = objApp.Workbooks
objBook = objBooks.Add
objSheets = objBook.Worksheets
objSheet = objSheets(Me.SheetNumber)
'you can name the objsheet
'objSheet.Name = "First Sheet"
range = objSheet.Range("A1", Reflection.Missing.Value)
range = range.Resize(Me.XSize, Me.YSize)
'Set the range value to the array.
Dim PxDt(Me.XSize, Me.YSize) As Double
For y = 0 To Me.YSize
For x = 0 To Me.XSize
PxDt(x, y) = Me.ArrayData(Me.YSize * y + x)
Next
Next
range.Value = PxDt

'Return control of Excel to the user.
objApp.Visible = True
objApp.UserControl = True

'Clean up a little.
range = Nothing
objSheet = Nothing
objSheets = Nothing
objBooks = Nothing
End Sub
End Class

With my short knowledge, I was hoping to assign pixel size by:
WriteDtToExcel.xsize = 100: WriteDtToExcel.ysize=100: WriteDtToExcel.DtA=dtarray and so on, and then run the subroutine for data export to Excel.
Ofcause, it is not working at all.
Could someone advice me what was wrong with me.
cheers,
Whity Hwang
AnswerRe: Creating Excel data class Pin
Ashfield17-Dec-08 22:43
Ashfield17-Dec-08 22:43 
QuestionSpeech to Converter Pin
JC.KaNNaN17-Dec-08 21:14
JC.KaNNaN17-Dec-08 21:14 
AnswerRe: Speech to Converter Pin
Christian Graus17-Dec-08 23:00
protectorChristian Graus17-Dec-08 23:00 
AnswerRe: Speech to Converter Pin
0x3c018-Dec-08 3:39
0x3c018-Dec-08 3:39 
QuestionAccess Backup file Pin
JC.KaNNaN17-Dec-08 20:27
JC.KaNNaN17-Dec-08 20:27 
AnswerRe: Access Backup file Pin
Christian Graus17-Dec-08 23:02
protectorChristian Graus17-Dec-08 23:02 
Generalbarcode Pin
jeje092617-Dec-08 18:35
jeje092617-Dec-08 18:35 
GeneralRe: barcode Pin
Christian Graus17-Dec-08 19:07
protectorChristian Graus17-Dec-08 19:07 
GeneralRe: barcode Pin
Anoop Brijmohun17-Dec-08 20:12
Anoop Brijmohun17-Dec-08 20:12 
QuestionActiveX Control in VB 6.0 Pin
Anu_Bala17-Dec-08 17:49
Anu_Bala17-Dec-08 17:49 
AnswerRe: ActiveX Control in VB 6.0 Pin
Dave Kreskowiak18-Dec-08 2:12
mveDave Kreskowiak18-Dec-08 2:12 
QuestionCopy Files from one directory to another Pin
samsonx17-Dec-08 17:42
samsonx17-Dec-08 17:42 
AnswerRe: Copy Files from one directory to another Pin
Christian Graus17-Dec-08 17:58
protectorChristian Graus17-Dec-08 17:58 
GeneralRe: Copy Files from one directory to another Pin
samsonx17-Dec-08 18:04
samsonx17-Dec-08 18:04 
GeneralRe: Copy Files from one directory to another Pin
Christian Graus17-Dec-08 18:07
protectorChristian Graus17-Dec-08 18:07 
Questionprogressbar in statusstrip vb.net Pin
jigneshDPatel17-Dec-08 16:43
jigneshDPatel17-Dec-08 16:43 
AnswerRe: progressbar in statusstrip vb.net Pin
Christian Graus17-Dec-08 18:01
protectorChristian Graus17-Dec-08 18: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.