|
I am having trouble when converting the following code from my original VB to VB.NET code. I wish someone can help me on this code,I keep on trying but it doesn't really runs. How should I change for it to run in VB.NET? Please give me some solution,I'm really new to this. Thank you so much~!
Private Sub TT_Engine_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Service_Name = "TT"
Label1.Text = Service_Name & "_Reminder"
If Dir(App.Path & "\Logs", vbDirectory) = "" Then
MkDir(App.Path & "\Logs")
End If
'############## Used For Log File ###########################################
Log_File_Name = Service_Name & "_Reminder.log"
Dim file_exist As Boolean
file_exist = mFileSysObj.FileExists(App.Path & "\Logs\" & Log_File_Name)
If (file_exist) Then
logFile = mFileSysObj.GetFile(App.Path & "\Logs\" & Log_File_Name)
Else
mFileSysObj.CreateTextFile(App.Path & "\Logs\" & Log_File_Name, True)
logFile = mFileSysObj.GetFile(App.Path & "\Logs\" & Log_File_Name)
End If
'################ Database Setting ######################################
MaxServerIP = "local"
MaxServerPass = "local"
DiServerIP = "local"
DiServerPass = "local"
MaxServerGatewayIP = "local"
MaxServerGatewayPass = "local"
DellServerIP = "local"
DellServerPass = "local"
End Sub
|
|
|
|
|
Use the File and Directory classes in System.IO namespace, like Directory.Exists(), Directory.CreateDirectory(), File.Exist(), File.OpenRead(), File.Create() et.c.
---
b { font-weight: normal; }
|
|
|
|
|
I'm sorry to disturb you again. I'm really new to this VB.NET. Can you give me more detail solution for this code? Or you may give me some example which is very similar to this?
Hope someone can give me a help here. Thanks~!
|
|
|
|
|
Look up the methods I mentioned in the documentation, and you will find examples on how to use them.
---
b { font-weight: normal; }
|
|
|
|
|
Have you tried using the code conversion add-in supplied in VS.NET ?
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
Hello,I didn't used any code conversion engine here. I need to migrate the engine from VB to VB.NET. Can anyone please give me some a solution for my code to change it to VB.NET?
Thanks~!
|
|
|
|
|
The easiest way to convert the code from VB6 to VB.NET is to open the VB6 project in Visual Studio 2005. VS will convert the project to VS 2005 and also convert the VB6 code to .NET (as much as it can anyway). You can then fix any remaining code manually.
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
Hi
I made a program that creates a desktop (by CreateDesktop API) and runs an application in that desktop, after switching to the new desktop.
Everything goes fine up to here and the program is run in the new desktop.
The problem is
that I want to switch back to the first (i.e. Default) desktop while the other program is still running in the new desktop.
I tried switchdesktop once again, and even tried running an other application in the Default desktop, but the Default user was not shown in any case.
My question is how can I switch between different desktops (in the same window station) where by swithching I mean giving UserInput to each.
Thanks
|
|
|
|
|
good afternoon.
i plan to create a bluetooth application(example an INFOCAST using cellphones with bluetooth capability) to be written in VB.NET and with database in MS Access. what other requirements do i need for the application?
thank you in advance
|
|
|
|
|
Hi Guys, I am displaying data in a datagrid control using a dataset. I want to select a particular record from the datagrid when I click using the mouse. The record details need to be displayed in a few textboxes which can be modified. Then the record needs to be updated back to the database.
Can anyone plz provide some solution for this. I am relatively new to .NET with no formal training.
With Best Regards,
Mayur
|
|
|
|
|
In the DataGrid1_CurrentCellChanged event use something like this:
TextBox1.Text = DataTable1.Rows(BindingContext(DataTable1).Position).Item("Field1")
In the Validated event of the TextBox1 write back the text value to DataTable1.
|
|
|
|
|
I have a pdf file and using GhostScript to convert a copy of png for preview.
and then I have a delete btn to delete the preview file.
However, the file is previewing in the picture box.
I have try to set the picBox.image = nothing first and then delete the file,
It still doesn't, Error on other application is useing the file.
I have try to dispose the picbox first, It works fine.
So, does any method to re-init the picbox?
or any other method to meet the target?
Thank you all.
|
|
|
|
|
When an Image object loads an image file, it's locked until the Image object is disposed. When you dispose of the picturebox, it naturally disposes it's Image object also. You can dispose of the Image object without disposing the picturebox, though.
Get a reference to the image in the picturebox before you remove the reference from the picturebox, so that you can dispose of the Image object:
image as Image = myPictureBox.Image
myPictureBox.Image = Nothing
image.Dispose()
---
b { font-weight: normal; }
|
|
|
|
|
Dear guys,
When using command OpenFileDialog, OpenFileDialog.FileName will return the full path of selected file directory and the file name itself. for example "C:\Temp\Test.txt". How to get only the path ( C:\Temp ) and the filename ( Test.txt ) ?
Thanks and regards
WiL
|
|
|
|
|
System.IO.Path has a number of helpful static methods.
I think the ones you want are GetFileName and GetFullPath
|
|
|
|
|
;);)Hey..i am totally new to this forum...an it wud b really gr8 of u guys to help me.
I am using a popup menu for my app. the popup menu is on the right click event of the tray icon.thru this menu..i am showin/hidin the system clock.
the prob is that wen i hide the clock...the space where the clock was still appears....so if i click on that space the clock still appears makin the whole code pointless.
However wen i hide the clock,and exit the app,all the icons occupy that space.Ditto happens if i click on show clock.
So the problem here is refreshing the system tray. i found a lot of suggestions that told me to use NIM_DELETE from the shell.i hav already added evrythin usin the api.this only solved my prb with my apps icon.but the clock problem still exists.can anyone help.pls
thx in advance
(do excuse me if this is a stupid query..but am kinda new )
Ppl who scratch their ass shudnt bite their fingernails
|
|
|
|
|
I am too
-- modified at 2:00 Monday 16th January, 2006
|
|
|
|
|
post your code...i'll try to help.
Eric Dahlvang-Programmer
|
|
|
|
|
Hey there.Below is the code.Am jus puttin the module in which i am havin a prob.You may need a WinLockDll.dll reference (which I took from this site "Locking Win32 apps -Antonio").
Thanks.
Private Declare Function Clock_Show_Hide Lib "WinLockDll.dll" (ByVal bShowHide As Boolean) As Integer<br />
<br />
Private Sub Command1_Click()<br />
Clock_Show_Hide (True)<br />
End Sub<br />
<br />
Private Sub Command2_Click()<br />
Clock_Show_Hide (False)<br />
End Sub
Ppl who drop their watch'es in d toilet r bound to have sh*tty time.
|
|
|
|
|
The problem is clearly in the WinLockDll.dll.
That is the code we need to see.
Eric Dahlvang-Programmer
|
|
|
|
|
Hey Eric.
You can check out the dll after you download the software demo from this link.
http://www.codeproject.com/win32/AntonioWinLock.asp[^]
The source code is given here as well.
Just see the procedures with respect to the system clock.Rest all, i am not using them.
Thanks a bunch.
Ppl who drop their watch'es in d toilet r bound to have sh*tty time.
-- modified at 23:06 Tuesday 17th January, 2006
|
|
|
|
|
What version of windows are you on?
here is some vb code to do the same thing without the dll
<br />
Private Const TASKBAR = "Shell_TrayWnd"<br />
Private Const ID_TRAY = &H12F<br />
Private Const ID_CLOCK As Long = &H12F<br />
Private Const IDM_TABLEPROPERTIES = 2210<br />
Private Const SW_SHOW = 5<br />
Private Const SW_HIDE = 0<br />
<br />
Private Declare Function UpdateWindow Lib "user32" (ByVal hWnd&) As Long<br />
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd&, ByVal nCmdShow&) As Long<br />
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long<br />
Private Declare Function GetDlgItem Lib "user32" (ByVal hDlg&, ByVal nIDDlgItem&) As Long<br />
'<br />
<br />
Private Sub Command1_Click()<br />
Show_Hide True<br />
End Sub<br />
<br />
Private Sub Command2_Click()<br />
Show_Hide False<br />
End Sub<br />
<br />
Private Sub Show_Hide(blnShow As Boolean)<br />
Dim hWnd As Long<br />
<br />
hWnd = GetDlgItem(FindWindow(TASKBAR, ""), ID_TRAY)<br />
hWnd = GetDlgItem(hWnd, ID_CLOCK)<br />
If hWnd = 0 Then Exit Sub<br />
<br />
ShowWindow hWnd, IIf(blnShow, SW_SHOW, SW_HIDE)<br />
UpdateWindow hWnd<br />
End Sub<br />
|
|
|
|
|
Hey! This works great.But still having the same problem.Tray wont refresh.
Windows xp sp2.
Ppl who drop their watch'es in d toilet r bound to have sh*tty time.
|
|
|
|
|
This don't really make sense to me...
But, try this:
<br />
Private Sub Show_Hide(blnShow As Boolean)<br />
Dim hWndTray As Long<br />
Dim hWndClock As Long<br />
<br />
hWndTray = GetDlgItem(FindWindow(TASKBAR, ""), ID_TRAY)<br />
hWndClock = GetDlgItem(hWndTray, ID_CLOCK)<br />
If hWndClock = 0 Then Exit Sub<br />
<br />
ShowWindow hWndClock, IIf(blnShow, SW_SHOW, SW_HIDE)<br />
UpdateWindow hWndClock<br />
UpdateWindow hWndTray<br />
End Sub<br />
Eric Dahlvang-Programmer
|
|
|
|
|
when i save d coding from ITCN ASP.NET Forum 2004, i met d error msg "cast forom string "01-16-2006" to type 'Date' is not valid" ... so how do solve such error.....
Angela ying
|
|
|
|