|
You don't export the DataGridView. You export the data that the grid is bound to, like a DataTable or a DataSet object. In either case, the process is the same. The easy way is to create a normal Text file with a filename of something.CSV (comma seperated values) and iterate through your data tables, row-by-row, writing each column value, converted to a string, to the file with a comma between the values.
The harder way is to instantiate an Excel object, create a new workbook, then a new worksheet in the workbook, go through your data tables the same way you do for a CSV file, and place each value in the tables into a cell in the worksheet, saving the workbook when your done.
There's tons of examples out on the net. All you have to do is Google for "VB.NET export datagrid to excel".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I want to set a column in a datagrid to display a time and not a date i am using vb.net 2003
|
|
|
|
|
You can specify a format string for a datetime, or call ToShortTimeString() to get the time only
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
How i add com reference to smart device project in vb.net 2003?
|
|
|
|
|
Click Project at the top and go to project properties. There is a reference tab. you can add it there
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hi
I can connect to the local COM port thru VB.Net
How can I connect to a COM port on a remote machine? What URL/URI do I give for the port address: is it "servername:port number" or something else?
What is the valid specification to access a remote port?
Obviously, I have not yet found any answers to the questions above. Can somebody help me in getting the answers?
Shreekar
|
|
|
|
|
You can't. There's no way you can just "connect" to a remote COM port like that. You have to have a remote application running on the target machine to use that machines COM port, then you establish a connection between your local app and the remote app over the network using any method you want, like .NET Remoting, WinSock, ...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I want to check if my string contains the character '"' how do I check that
I am using Instr() presently, but the line of code
InStr(sFile, """)
but this gives an error
Can you please help
|
|
|
|
|
Are you trying to see if the string contains a quote character? If so you need to double it up inside the string. Also are you using vb.net or vb6. If it's .net you should use the 'contains' method
sfile.Contains("""")
If it's not .net then just use
InStr(sFile,"""")
|
|
|
|
|
I am using vb6 not .net
I want to check for a double quote but only " once.
Will the expression you stated above check for "" or just " , which i want
|
|
|
|
|
It will check for a single double quote as in ". You need to double it up inside the string though to use it as a literal quote so you need """".
|
|
|
|
|
|
|
I don't understand the question ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
How do I check if a folder already exists on the system without including any classes in my code?
I dont know why the Try-Catch block does not work in my code. It gives compilation error that try is not excepted
|
|
|
|
|
if (System.IO.Folder.Exists(
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
First, what version of VB are you using? Second, what does you code look like?? Without that, it's really hard to tell you what you did wrong.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Heah thanx, I got the thing working with the following piece of code
Dim folderPath As String
Dim fs
folderPath = "C:\test"
Set fs = CreateObject("Scripting.FileSystemObject")
If (fs.folderexists(folderPath) <> True) Then
MsgBox "Folder does not Exist"
Else
MsgBox "Folder Exists"
End If
|
|
|
|
|
Is there a best practices guideline for creating forms that are least likely to look different across deployment (that is, with users using different display sizes, fonts, font sizes, etc.)?
Thanks
|
|
|
|
|
less is more
My advice is free, and you may get what you paid for.
|
|
|
|
|
I have to write a program, in vb.net 05, that does some clean up. The desired time for the program to run is when the user logs off and the computer begins the shutdown process. I realize I could probably use "Scheduled Tasks" to run the program at log off/shut down, but I'd like to use the registry to execute the program at logoff/shutdown.
I've got the guts of the program already written, I just need to figure out how to write to the registry to run at logoff/shutdown. Any help is appreciated!!!
|
|
|
|
|
|
hi,
what is the exact keyword for vb.net Freind access modifier type in C# ??
Thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|