|
Hi Every Body
I asked before you about the way to export the DataSet into Excel Sheet, but I still have a problem in this subject...The code which I use is the following:
dim tblname as DataTable
Dim ExcelApp As Excel.Application = New Excel.Application
Dim Workbooks As Excel.Workbooks = ExcelApp.Workbooks
Dim Workbook As Excel.Workbook = Workbooks.Add(System.Reflection.Missing.Value)
Dim Sheets As Excel.Sheets = Workbook.Sheets
Dim Worksheet As Excel.Worksheet = Sheets("Sheet1")
Dim RowsCount As Integer = tblname.Rows.Count
Dim ColsCount As Integer = tblname.Columns.Count
Dim ColsCounter As Integer
Dim RowsCounter As Integer
'Columns Header
For ColsCounter = 0 To ColsCount - 1
Worksheet.Cells(1, ColsCounter + 1) = tblname.Columns(ColsCounter).ColumnName.ToString
'First Row for Columns Header
Next
For RowsCounter = 0 To RowsCount - 1
For ColsCounter = 0 To ColsCount - 1
Worksheet.Cells(RowsCounter + 2, ColsCounter + 1) = tblname.Rows(RowsCounter)(ColsCounter)
'Start With the Second Row Because First Row for Columns Header
Next
Next
ExcelApp.Visible = True
ExcelApp.UserControl = True
Note: After many searches over the Internet, I have found that the reason for the error in the previous code is named Late Binding, and I think that this is the main reason for the problem is what I said about the Late Binding. Is there any body know about this problem and the solution about it?
Simsem
|
|
|
|
|
You have not set the DataTable variable!
It should be something like:
Dim tblname As DataTable
tblname = MyDataSet.Tables("MyTable")
Then the rest of your code...
As it stands, the DataTable variable is empty.
Steve
|
|
|
|
|
The DataTable here is not empty because I am passing its value from another table using a query....so it is not empty
|
|
|
|
|
I don't see any kind of query in the code you posted...
You have just dimensioned your table and not assigned any data to it as far as I can see. Is there more code that you have not included?
Steve
|
|
|
|
|
The query exist in another form, I store the contents of the query in a DataTable and then pass this DataTable to my form where I display these data in a DataGrid and then I wanna Export these Data To Excel. So that be sure that there is a Data in the DataTable.
with Kind Regards.
your sincerely OBarahmeh
|
|
|
|
|
|
please help me with code which i can use to shutdown the application after 30mints, my application contains multi-forms and i want this code to be run when i click the start button on the second form "Form2".
Please note that i'm using the following code under the next or back buttons to switch between forms
< unload me
Form3.show >
as for example if i put timing code in Form2 , will this code stop when i click the next button which contains the code above?
Please advise and thank you for your help
Ali
|
|
|
|
|
Record the time when the user clicks on the "Start" button and start a timer (with a 1 minute interval) that will check the current time against the recorded one and close the application if 30 minutes have elapsed.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
This is a very smart way , but how can i record the time from the system clock and what will be the data type for the variable which i will store the time in it to compare with the current type.
Please advise and thank you for your help.
Ali
|
|
|
|
|
Have a look at the System.DateTime class.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi
This is the first time I am replying a query. All the Best!. Unless you unload the form that contains the Timer control you can keep count of the ticks.
In the timer control event you check for the period after which you want to close the application.
If it is visual basic, you can use this code,
Close All
End
If it is vb.net
Application.Exit
Hope this helps you.
Kanniah
|
|
|
|
|
hii all,
i have to devlop a vb.net application which works with pdf files.its a reader which upload pdf files and extract each page to JPEG format. but the core of the project depends on the "page turning effect(page flips over the reader while clicking Next/Previous button as in real magazine). i wuld like to add some graphics effect to the page flipping. i heard that ghostscript/postscript works with pdf files and these are providing graphics or curling effects to pdf pages. i want to deploy ghostscript/postsript code to vb.net application. Is It possible ? if yes, how ??
best regards
kannan
|
|
|
|
|
You can't use Ghostscript/Postscript in your VB.NET code. There is no component in the standard toolbox that understands those languages either. You'll need a 3rd party component that can render this stuff for you. I, unfortunately, don't know of any myself. You might want to try Googling for it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Please Help Me
How to avoid spelling mistek in text box (vb 6.0)
|
|
|
|
|
Implement a dictionary and check it after every keystroke ... be prepared to work hard
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Sinchan Nikam wrote: spelling mistek
Good luck to you.
|
|
|
|
|
Sinchan Nikam wrote: How to avoid spelling mistek in text box (vb 6.0)
Two ways to do it.
Purchase a third party libary.
use word to do it, this is a huge pain to do (not recommended really, it can be rather tedious).
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Hello Sinchan,
ComponentOne has the VSSpell 8 control, which is an ActiveX control designed for use in VB6. It has both dictionary and thesaurus functionality, and has a utility to allow you to edit the existing or create new dictionaries and thesauruses. For more information, please visit http://www.componentone.com/products.aspx?TabTypeID=1&ItemType=1&PanelIndex=16&ItemID=54015&SubCategoryTypeID=0&TabMapID=92&TabID=111[^]. If you think that you may be interested, you can download a fully functional trial. The trial will have a sample application to show you how to use the control to spell check a textbox, among other text sources.
Suelinda W
Customer Engagement, ComponentOne LLC
|
|
|
|
|
Please Help Me !!!
How to check spelling mistek in perticular text box (vb 6.0)
-- modified at 3:21 Wednesday 30th August, 2006
|
|
|
|
|
Hi All, I am new to VB.net and I am struggling with small function I need to write. Basically this function must get results from two different datareaders, Oledb and SQL and compare the results.
Is using a datareader the right way of going about a comparison between two recordsets, or is there a better way. Basically I need to compare the results of the two recordsets and the differences must be noted in a file.
Any help will be appreciated.
Regards
Scorn.
|
|
|
|
|
Hi
You can go for Datasets, which is much easier to loop (as you can forward / rewind the dataset) you cannot do this in a datareader.
All the Best!
Kanniah
|
|
|
|
|
Hi Kanniah,
I am going to try Dave's solution first as I would like to save on resources. Should I not get it right I will try your solution.
Thanks for the reply.
Regards
Sean
|
|
|
|
|
You can do this with DataReaders. They'll be faster and more memory efficient than loading entire sets of data. They also offer the flexibility of looking at millions of records without loading them all into RAM.
After that, you just compare record for record, incrementing each DataReader to compare then next records.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi Dave,
Thanks for your reply, I will give your answer a try and see how I do.
Regards
Sean
|
|
|
|
|
Hi Dave,
I need to pick your brain some more please. I have managed to get right what I wanted to do, however I would like to know if this is the correct way of doing it, or if there is a different way. Once again is this code resource effiecient?
<br />
Public Function fnCheckClientMasterRecords() As Boolean<br />
<br />
Dim dbrAsiClients As SqlDataReader<br />
Dim dbrXpressClients As OleDbDataReader<br />
<br />
'Two functions that return the records that I need to compare and populates my new datareaders<br />
dbrAsiClients = fnGetAllASIClients()<br />
dbrXpressClients = fnGetAllXpressClients()<br />
<br />
<br />
While Not dbrAsiClients.Read = False<br />
While Not dbrXpressClients.Read = False<br />
If Not Left(dbrAsiClients.GetValue(0).ToString(), 6) = Left(dbrXpressClients.GetValue(0).ToString(), 6) Then<br />
MessageBox.Show(Left(dbrAsiClients.GetValue(0).ToString(), 6) & " - " & Left(dbrXpressClients.GetValue(0).ToString(), 6))<br />
Else<br />
'Yes code here<br />
End If<br />
End While<br />
<br />
'Do I have to close the reader here everytime I Have looped through it and re-populate it.<br />
dbrXpressClients.Close()<br />
dbrXpressClients = fnGetAllXpressClients()<br />
<br />
End While<br />
End Function<br />
Your input will be appreciated.
Kind Regards
Sean Venter
|
|
|
|