|
For me personally, I prefer !
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
and !VB!
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: and !VB!
Yeah.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
i am new to visual basic and i have a task to design a programme using visual basic for excel to import the raw data and sort it accordingly. i also have to decode that raw data into meaningful data. I hope I can get some guide to finished my task..thank you for all the help.
miss_naz.
|
|
|
|
|
You should look at using OLEDB Data Connections - much quicker than using reference to excel Application object.
Set up you connection something like this:
Dim cn As New OleDbConnection
cn = New OleDbConnection
cn.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;" & _
"Data Source=" & filepath & ";" & _
"Extended Properties='Excel 8.0;HDR=YES;'"
- Where filepath is your Excel File and Excel x.x is the version of Excel on your system.
(You will need to add a reference to the Microsoft Excell Library)
Once this is set up you can write basic queries on the data. Use a OleDbCommand and OleDbDataAdapter and DataSet etc.to catch the data from Excel.
Make sure that your Excel Worksheets are "Flat",
IE: One Header Row and similar data in each column. Try to stick to same datatypes in each column.
There is quite a lot of information out there - Search for "Excel, OleDeb"
Hope this helps
Kiwi Andy
|
|
|
|
|
How to show a message box which close after specified time?
I know that this can be done by adding another form with the text want to show as messagebox.I tried with a new form by using the following line
dim msgform as new form
msgform.showdialog
it shows the form but did not execute the next line.
Ejaz
|
|
|
|
|
ejaz_pk wrote: msgform.showdialog
This shows a modal dialog, your next line won't execute until the form is closed. To do this, you need to write a form which has a timer internally, and closes itself.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Is this possible to resize the column width according to the column text.
I means If user double click on the header to adjust the width of the single column it should adjust all the columns width just like excel?
Ejaz
|
|
|
|
|
My program watches for two different files to change. txt file and mdb table. Here is my initial code.
<pre><code>Dim watcher As New FileSystemWatcher
Dim tablewatcher As New FileSystemWatcher
watcher.Path = "C:\Documents and Settings\bin"
tablewatcher.Path = "C:\Documents and Settings\bin"
tablewatcher.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite Or NotifyFilters.FileName Or NotifyFilters.DirectoryName Or NotifyFilters.Size)
watcher.Filter = "*.mdb"
tablewatcher.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite Or NotifyFilters.FileName Or NotifyFilters.DirectoryName Or NotifyFilters.Size)
tablewatcher.Filter = ".txt"
' Add event handlers.
AddHandler tablewatcher.Changed, AddressOf OnChanged
AddHandler watcher.Changed, AddressOf OnChanged
' Begin watching.
tablewatcher.EnableRaisingEvents = True
watcher.EnableRaisingEvents = True</code>
My question is, is there a way to tell which file was changed? I have the following Onchanged method that I want to do one thing for one Onchanged and something else for a different Onchanged.
Private Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)
end Sub
How can I check to see which Onchanged happened? Or can I?
|
|
|
|
|
Hi Cory,
if you want completely different actions for both, why bother having only one
handler ? Just create two different handlers, and adjust the AddHandler lines.
if you want nearly the same handling, have one handler and look at the source
Object, I expect you can cast it to a FileWatcher, then compare to one of the
two FSW you instantiated (or you could set up a Hashtable or Dictionary to
associate some object to each of them).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Is this possible to show an image in the subitem of the listview instead of showing that in the first column of the listview?
Thanks in advance
Ejaz
|
|
|
|
|
If it is, it would involve owner drawing ( that is, writing your own code to draw the control ). By default, no.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Hi,
I need to add an event to when a user double clicks on the webbrowser. I thought of adding it using the AttachEventHandler onto the webbrowser.document object but am not sure about the syntax. I would appreciate any help in this regard.
Thanks alot!
Ahmad
|
|
|
|
|
Can you please assist me with the coding of MediaPlayer or MS-Paint using VB.net. It is part of my assignment I don't even know where to start.
I'll appreciate your assistant
Thank you.
|
|
|
|
|
You really need to try something, then if you run into a problem post your specific problem. In general we try not to do peoples homework for them.
Ben
|
|
|
|
|
Hello,
VS 2005
For some reason this simple bit of code doesn't work. it keeps throwing me an exception "Cannot create a file when that file already exists."
[CODE]For Each myFile As String In IO.Directory.GetFiles("G:\Temp1")
IO.File.Copy(myFile, "G:\Temp2")
Next myFile[/CODE]
I just want to move the files from 1 folder into another.
Many thanks for any suggestions.
Steve
|
|
|
|
|
You must already have the file "G:\Temp2". The code doesn't know what to do if the file already exists. If you want to replace the file, you will first have to check that the file exists, then delete it, and THEN move the file.
Hope this helps.
|
|
|
|
|
first of all you need to provide a name for the file to copy to
so:
dim myfilename as string()=myfile.split("\")
io.file.copy(myfile,"g:\temp2\" & myfilename(myfilename.length-1)) 'this is out of memory so could contain a mistake
second:
the error you get states that the file already exist (at the moment that because you try to override you map but you can get this when you run you'r program twice in a row)
you get this error because the override property is set to false on default
to change this:
io.file.copy(myfile,"g:\temp2" & myfilename(myfilename.length-1),true)
hope this helps
|
|
|
|
|
Hello,
thanks for the reply.
I manage to do it like this:
<br />
For Each myFile As String In IO.Directory.GetFiles("C:\Inetpub\wwwroot\PC8")<br />
filepath = String.Format("{0}{1}", physicalPath, myFile.Substring(myFile.LastIndexOf("\")))<br />
<br />
IO.File.Copy(myFile, filepath)<br />
Next myFile
If i have some folders in the same directory, which is the best method to copy them?
Many thanks,
|
|
|
|
|
for folders you can folow a simular way only you need to use getdirectories and createdirectory
see code below
For Each myFile As String In IO.Directory.GetDirectories("C:\temp")
Dim filepath As String = myFile.Substring(myFile.LastIndexOf("\"))
IO.Directory.CreateDirectory("c:\temp2" & filepath)
Next myFile
|
|
|
|
|
I have a case on an MDI form where there may be unsaved data and Im trying to allow the user to cancel the close process instead of just a Yes No answer.
Is there a way for me to know that the MDI form closed or didnt close?
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Handle the FormClosing event. You can ask the user whatever question you like and set the e.Cancel = True to stop the form from closing.
Mike Lasseter
|
|
|
|
|
Yes I do that but I also do some other activities in the Main Form and they seem to be done regardless of what happens in the form closing of the MDI.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
How are you handling the events in the main form? Are you responding to the FormClosing Event if so you should be monitoring the FormClosed Event. Besides guessing, I don't have enough information to help solve the problem.
Mike Lasseter
|
|
|
|
|
The main form does a Me.ActiveMDIForm.Close.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|