|
Hi,
I'm using VB.NET 2005.
I've been playing around with a couple of macros lately and I've noticed that Debug.Print doesn't actually print anything to the Immediate Window. I've also tried Console.WriteLine but that doesn't work either. Neither one causes any errors, they just don't display anything. Is there any other way to get this functionality (At the moment I use a messagebox to show values at certain points but I figure there must be a better way).
Thanks very much,
dlarkin77
|
|
|
|
|
The output will show in the Output window, not the Immediate window. Have you launched a second Visual Studio instance to debug the code? IIRC, the instance of Visual Studio that your running in the code in cannot also debug it at the same time.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I have tried opening a second instance of VS. I double-click on the particular macro (in the Macro Explorer) in the first instance. Should I see the output in the second instance? At the moment I don't see any output. I've checked the immediate window and the output window in the second instance but there's nothing there.
Thanks,
dlarkin77
|
|
|
|
|
My data grid is showing some information from MYSQL using the ADODC.
How can i put this information from my DATA grid to EXCEL????
|
|
|
|
|
Hi
We are doing VB project, VB as frontend and mysql backend. How to write coding for mysql backup
thanks
KK
|
|
|
|
|
Hi,
I have a problem updating a spreadsheet. I can read the info into a datagridview, but cant get it to update... actually I am not to sure how to update the spreadsheet. Can someone maybe help me, or direct me to some site that can be helpful.
Code for select/read:
<br />
Public Shared Function OpenSpreadsheet(ByVal strPath As String) As DataTable<br />
<br />
'Create new dataset to hold information<br />
Dim tableStatement As New DataTable()<br />
Dim column(1) As DataColumn<br />
<br />
Try<br />
'Connectionstring to the xls spreasheet on local/network drive<br />
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
"Data Source=" & strPath & ";" & _<br />
"Extended Properties=""Excel 8.0;"""<br />
<br />
'strConn..open()<br />
<br />
Dim daTimesheet As New OleDbDataAdapter("SELECT * FROM [Sheet1$B8:F30]", strConn)<br />
daTimesheet.Fill(tableStatement)<br />
<br />
<br />
tableStatement.PrimaryKey = New DataColumn() {tableStatement.Columns("projectID")}<br />
<br />
Catch Ex As Exception<br />
MessageBox.Show("Cannot fill Datatable. OpenSpreadsheet(): " & Ex.Message)<br />
<br />
Finally<br />
tableStatement.Dispose()<br />
'strConn.close()<br />
<br />
<br />
End Try<br />
<br />
Return tableStatement<br />
<br />
End Function<br />
Code for update:
<br />
Public Shared Function UpdateSpreadsheet(ByVal strPath As String) As DataTable<br />
<br />
Dim tableStatement As DataTable = New DataTable<br />
<br />
'Connectionstring to the xls spreasheet on local/network drive<br />
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
"Data Source=" & strPath & ";" & _<br />
"Extended Properties=""Excel 8.0;"""<br />
<br />
Try<br />
<br />
Using connection As New OleDbConnection(strPath)<br />
<br />
Dim adapter As New OleDbDataAdapter()<br />
adapter.SelectCommand = New OleDbCommand("SELECT * FROM [Sheet1$B8:F30]", connection)<br />
adapter.UpdateCommand = New OleDbCommand("UPDATE [Sheet1$B8:F30] SET FirstName= ?, LastName = ?", connection)<br />
<br />
Dim builder As OleDbCommandBuilder = New OleDbCommandBuilder(adapter)<br />
<br />
connection.Open()<br />
<br />
adapter.Fill(tableStatement)<br />
<br />
tableStatement.PrimaryKey = New DataColumn() {tableStatement.Columns("projectID")}<br />
<br />
' Code to modify data in DataSet here <br />
<br />
adapter.Update(tableStatement)<br />
<br />
'Return 1<br />
Return tableStatement<br />
<br />
End Using<br />
<br />
Catch Ex As Exception<br />
MessageBox.Show("Cannot Update Datatable. UpdateSpreadsheet(): " & Ex.Message)<br />
'Dim strErrorUpdate As String = "Cannot Update Datatable. UpdateSpreadsheet(): " & Ex.Message<br />
<br />
'Return strErrorUpdate<br />
<br />
End Try<br />
<br />
End Function<br />
|
|
|
|
|
I am new to vb2005. I dun understand y do my DTPicker keep showing the calendar only. i have already set the formal to time but it only display the time but when i click the dropdown arrow it still show the caledar. Anyone knows how to change the calendar to time???
|
|
|
|
|
What do you expect it to show when dropped down?
|
|
|
|
|
I tot the DTPicker should show some default time for user to choose. i am confused as well? Cos i am doing the scheduler project require my user to choose the time for the shutdown to be perform. Wont the dropdown show some default selection which the user can select?
|
|
|
|
|
I'm calling a form with the show method, i would like to pass in a value from the calling form to the called form, to be used in form_load event.
How can I do this?
PJ
|
|
|
|
|
First you need to create the form before calling the Show() method.
Then you can pass the values either by creating parameters in the called form, or creating a function that receives parameter in the called form.
Another way is to create a new constructor of the form that accepts parameters.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
Thanks for you help!
It's a bit wet here in Sydney
PJ
|
|
|
|
|
It's hailing in Hobart...
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
In the called form, you declaire a public shared variable like:
Public Shared myVar
In the calling form you will:
Dim mf as New CalledForm
mf.myVar = .....
mf.ShowDialog()
mf.Dispose()
Is this your need?
|
|
|
|
|
|
That's wrong. There is no need for the variable to be static ( shared ).
Also, it's much nicer to pass it through a constructor, although a public variable will work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
if you want to run a EXE (Name : WW) from an other EXE (Name : QQ) with value sent to it you can use
sell "ww.exe value",vbnormalfocus
it is good and semble
soly
|
|
|
|
|
Hello
I am working with VB.Net, I want to read/write text data in remote server which is running on the same LAN.
I used the following code which gives an error
Imports System.IO
Imports System.IO.StreamReader
Dim path As String = "\\Server Name\Data\BarCode.txt"
Dim DirPath As String = "\\Server Name\Data"
Dim sw As StreamWriter
Dim di As DirectoryInfo
If Directory.Exists(DirPath) = False Then
di = Directory.CreateDirectory(“Data”)
End If
If File.Exists(path) = False Then
sw = File.CreateText(path)
sw.WriteLine("This is Test ")
sw.Flush()
sw.Close()
End if
How to make it working format?
Thanks
Muru
|
|
|
|
|
And that error is????
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
it through run time error. How to add user name, Password and Domain of the remote server?
|
|
|
|
|
If your machine and the remote machine are in the smae Windows domain, the code will use your security token to get into the remote machine. If your is seperate domains or in workgroup mode, you have to supply a username and password that the remote machine will recognize and has the appropriate rights to get at the network share you want on that server.
You can map a drive to that share then use it just like any normal drive letter. You can find and example here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi
Thanks for your quick reply. Actually my exact requirement is, I am running VB.Net mobile application for Windows CE.Net 4.2 OS. I want write log file on the Server which running on the same LAN. Will it possible to map drive in Window CE.Net 4.2? Or Is there any other way write data to the server file? Kindly please assist me
Thanks
Muru
|
|
|
|
|
I have no idea. I don't do mobile development. You probably should have added that major detail to your original post. Ask in the Mobile Development forum for a more qualified answer.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello,
I have a menu that a user can click and open a window. However, if the user was to click this form many time, it will continue to open up more windows. I want to prevent this from happening. If the user clicks open, it should just open the window once, if the window is already open, then it should get focus for that window.
I hope you understand, this is my code so far.
<br />
Dim rep10 As New NewCalls<br />
rep10.MdiParent = Me<br />
rep10.Show()<br />
Thanks in advance,
steve
|
|
|
|
|
http://www.codeproject.com/vb/net/Simple_Singleton_Forms.asp
|
|
|
|