
micropathic
Avatar/Signature-
Posts
77 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by micropathic
-
If I have a command button, and want to test whether or not it has been clicked or not, what would be the syntax to do so. For instance if the event for the clicking the command button is something like.. sync.click, how would I say: if sync.click = true then end if When I type form1 and put a period after it, the inline dropdown menu doesn't give me the option to choose sync.click. TIA
-
Not sure what that means, if you would be so kind as to explain I would be very greatful. The part I'm not clear on is the "unmanaged component". I'm not sure what that is or where to look for it. Thanks!
-
For whatever reason I am getting the error "Class Not Registered" in the debug window when I am building my project. When I double click it, it brings me to the first line in my project which is "Option Strict" off. Not sure what to do about it... Any help would be greatly appreciated!
-
Or if no one knows of a tutorial, maybe someone knows of a setup project sample somewhere? I'm just curious as I only have the standard version of vb .net, which doesn't include the setup wizard. Thanks!
-
Is there a vb .net "setup" project tutorial out there somewhere? The walkthough provided in the help is not all that in depth. Thanks for your help
-
The skinner was a vb6 activex control that allowed you to skin forms in a relatively easy way and the. SregoCETPx1 is also an activex control that lets a desktop app communicate with a Windows CE device such as a pocket pc. The sendmessage is being used in the Form_Load event to close any current instance of the program that is already running and CoTaskMemFree and lstrcat are being used in the "Browse for folder function". Since I've just started converting this project over to .net, I've mainly just been trying to get it to work by whatever means necessary first and then upgrading as much of the code as possible to .net after that. Thank you both for your help though, I really need it at this point as I'm feeling a little lost still with .net!!
-
Good catch Plausibly Damp! How would I find the .net equivelant ot the overallprogressbar? Thanks!
-
After commenting out the DoEvents the problem was still occurring. I determined that the problem was actually multiple calls of this line: Form1.DefInstance.overallprogressbar.Value = 0 Also I will check out seperate threads, because you're right about the multiple DoEvents, they were put there to let the user interact with the form while it was running, however they really haven't been doing that great of a job of achieving this. I really appreciate your help with this problem, Thank You!
-
Actually after a little more testing, it seems to happen when the sync_click event is fired.... either by the "RSSYNCME" command line argument, or by hitting the "Synchorinize" button on the form. It must be something in the sync_click event that is actually causing this to happen.
-
Here is Form1 and the Sub Main() in a class file named initialize so you can get some idea of what I'm trying to work with. Be warned though... the code is not pretty.. this is my first .net project and was also my first and only VB6 project. But I'm trying so here it is: I should also mention something that I just noticed. The form duplication problem only occurs when I supply the command line argument "RSSYNCME" which is handled at the end of the Form_Load section. Good Luck and Hope You Can Help! Thanks form1 and init class.zip
-
Tried that... But after I close the form1 while THIS .ocx I'm using is still processing something, it throws an exception concerning the disposal of Form1 and when I choose to "debug" it in VS it goes to the code at the top Form1 that was generated by the Windows Form Designer where it says something like "Friend Classs" Form1 (I'm at work right now so I'm not really looking directly at it). The only way I could prevent this was to start the form from the Sub Main(), but now it's giving me this strange duplicate form problem. So if you know of anything I might be able to do I would be very greatful!! Thanks!
-
Thank you for your help, I actually do have to perform a task before form1 loads. I made the Sub Main() because I needed to perform a Try...Catch statement before starting Form1. Is there a work around for this? For instance, should I put the code in the form_load event of Form1 in the Sub Main() and remove the form_load event from Form1?
-
My problem is that 2 instances of form1 are starting when I load my program. The problem occurs when starting the form from a Sub Main() contained in its own class. My main question is, do you still use form_load if you start your form from Sub Main() or does this cause problems? Thanks!
-
How can I make this code work in .net
micropathic replied to micropathic's topic in Interoperation / Office Integration
That worked! Thanks!!! -
Let me just start off by saying I'm a bit of a noob and I know my code is pretty. However for learning purposes I just need to figure out how to make the following code work in .net. The code is designed to kill another instance of an app using sendmessage and the window's name. I've searched the forum for a better alternative to using sendmessage, but had no luck with the code I found. The problem with the code right now seems to be with "lhWnd"'s type as vb.net throws an invalid cast exception when I try to run it. Any suggestions? Thanks in advance! Const WM_CLOSE As Integer = &H10s Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hwnd As IntPtr, _ ByVal wMsg As Integer, _ ByVal wParam As Integer, _ ByVal lParam As Long) As Integer Private Sub Form_Load() If (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0) Then GoTo ChangeCaptionName Else GoTo SkipChangeCaptionName End If ChangeCaptionName: Dim lhWnd As long Dim r As Short Me.Text = "*" & Me.Text lhWnd = FindWindow(vbNullString, "Rubber Stamped Sync") If lhWnd <> 0 Then ' MsgBox lhWnd '*************LINE BELOW THIS IS THE PROBLEM********* r = SendMessage(lhWnd, WM_CLOSE, 0, 0) ' MsgBox lhWnd End If ' MsgBox lhWnd Me.Text = Mid(Me.Text, 2) SkipChangeCaptionName: End Sub
-
Any ideas as to why this snippet of code is throwing the error: An unhandled exception of type 'System.Runtime.InteropServices.InvalidComObjectException' occurred in mscorlib.dll Additional information: COM object that has been separated from its underlying RCW can not be used Code: '****************Code uses "Srego" activeX control to pull and push files to and from specified device*********************************************** 'MsgBox actualspvpath overallprogressbar.Visible = True Picture1.Visible = True Label2.Text = " " Label3.Text = " " ' List1.Clear System.Windows.Forms.Application.DoEvents() If SregoCETPx1.PullFileEx(SPVDirResult, PCDirResult, "/d") Then 'App.Path & "\RubbersSSyncIT", "/d") Then System.Windows.Forms.Application.DoEvents() List1.Items.Add("File Sync From Device Completed Successfully.") Label2.Text = "File Sync From Device Completed Successfully." Else System.Windows.Forms.Application.DoEvents() List1.Items.Add("No files To Copy From The Device") Label2.Text = "No Files To Copy From The Device" End If List1.Items.Add("") System.Windows.Forms.Application.DoEvents() If SregoCETPx1.PushFileEx(PCDirResult & "\" & "*.*", SPVDirResult, "/d") Then System.Windows.Forms.Application.DoEvents() List1.Items.Add("File Sync To Device Completed Successfully.") Label3.Text = "File Sync To Device Completed Successfully." Else 'MsgBox "source" & (mydir) 'MsgBox "destination" & myspvdir System.Windows.Forms.Application.DoEvents() List1.Items.Add("No Files To Copy To The Device") Label3.Text = "No Files To Copy To The Device" End If List1.Items.Add("") Dim gg1, b As Short If chkLogSync.CheckState = 1 Then gg1 = FreeFile() FileOpen(gg1, VB6.GetPath & "\" & "sync.log", OpenMode.Append) For b = 0 To List1.Items.Count - 1 WriteLine(gg1, VB6.GetItemString(List1, b)) Next FileClose(gg1) Else 'do nothing End If Form1.DefInstance.overallprogressbar.Value = 0 ' overallprogressbar.Visible = False Picture1.Visible = False '************************************************ Form1.DefInstance.overallprogressbar.Value = 0 ANY help would be greatly appreciated!!!
-
Can't get command line argument to perform action
micropathic replied to micropathic's topic in Windows Forms
Thanks!! that worked! And yes, a lot of the code in this project was generated by the upgrade wizard. This is my first project in .net and I'm just now learning the ins and outs of the change in the language. I figured upgrading this project from its old vb6 version would be a good way to learn .net and so far thanks to the help of people such as yourself it hasn't been all that difficult. Thanks! -
Hi, I am trying to simulate clicking a command button I've named "sync" by using the following code: Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load '*************This Part Works Correctly***************** Dim nBufferKey, nBufferSubKey As Integer Dim nBufferDATA As String nBufferDATA = Space(256) RegOpenKey(LOCALMACHINE, "SOFTWARE\Microsoft\Windows CE Services", nBufferKey) RegOpenKey(nBufferKey, "AutoStartOnConnect", nBufferSubKey) RegQueryValueEx(nBufferSubKey, "Rubber Stamped Sync", 0, REG_SZ, nBufferDATA, Len(nBufferDATA)) 'MsgBox(nBufferDATA) txtChkBx.Text = nBufferDATA Dim MyStr As String Dim myStr2 As String myStr2 = Trim(txtChkBx.Text) MyStr = VB.Right(myStr2, 8) '***********End Of Code That Works correctly************** If Microsoft.VisualBasic.Command() = "rssyncme" Then '*****This is working and IS retruring "rssyncme" as the command line argument********** Form1.DefInstance.Sync.PerformClick() '*************This seems to be problematic for some reason!!!********** End If End Sub Getting the "rssyncit" string as the command line argument is working correctly. Clicking the button "sync" manually works fine, but when trying to automate it as shown in the code above, for some reason it doesn't work. Any help would be greatly appreciated!!!:)
-
That worked, thanks so much!!
-
Not sure what it is, but even w/ that code it's still throwing this at me: An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll Additional information: Cast from string "" to type 'Date' is not valid. And then it "marks" the line: lblDaysLeft.Text = "Days Left Until Trial Expires: " & DateDiff(Microsoft.VisualBasic.DateInterval.Day, Today, daytrialends) Thanks for your help!
-
I am new to .Net. This is my first project, which is upgrading an app I had working in VB6. My question is about how to make the following code work in VB .Net given that the upgrade wizard wasn't able to do it automatically and I have not been able to figure it out by searching the forum. Any help would be GREATLY APPRECIATED!!! Code: Dim MyString as string MyString = CStr(System.DateTime.FromOADate(Today.ToOADate + 30)) daytrialends = MyString '**************************************** 'UPGRADE_WARNING: Couldn't resolve default property of object daytrialends. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"' '**************************************** lblDaysLeft.Text = "Days Left Until Trial Expires: " & DateDiff(Microsoft.VisualBasic.DateInterval.Day, Today, daytrialends)