You could just pass the form to the class during instantiation using 'this' keyword. For example, assume your form is called MyForm and has a function called MyFormFunction that you want to call from MyClass: during instantiation in MyForm: MyClass newClass = new MyClass(this); in MyClass: private MyForm _externalForm; //declare as class level private variable //ctor public MyClass(MyForm passedFormReference) { _externalForm = passedFormReference; } public MyFormFunction() { _externalForm.MyFormFunction(); } Hope this helps, Regards, ----- Josh Lindenmuth jlindenmuth at paycepayroll dot com Payce Payroll - Smart for Business
Josh Lindenmuth
Posts
-
need reference to parent object -
Generating Product Licence KeysHow about this? http://www.sentientfood.com/display_story.php?articleid=3[^] There are many different ways of skinning the cat, depending on your O/S, platform, application, security needs, etc. Try googling 'open source software license keys'. Regards, Josh Lindenmuth
-
Project managementI use Microsoft Project. While it's a little pricey, it's definitely worth the money given it's ease of use, collaboration abilities (particularly if you have multiple managers), and integration with Microsoft products. If you're looking for a Linux based product or something that is free, take a look at sourceforge.net. We tried a few open source project management packages about a year ago, but none of them came close to Project's capabilities. Best of Luck, Josh Lindenmuth
-
Trouble with marshalling structureHello, We are trying to marshal a simple C structure within our C# code. All values are coming across except for doubles (bolded below). A double comes across as junk. Any help you can provide would be appreciated. Here is our C structure:
struct other_earn { short o_id; char o_desc[12]; char o_tpind[2]; char o_payee[31]; char o_addr1[31]; char o_addr2[31]; char o_addr3[31]; char o_hours[2]; **double o_amt1**; short o_dept; char o_txficas[2]; char o_txficam[2]; char o_txfit[2]; char o_txfuta[2]; char o_txsit[2]; char o_txsuta[2]; char o_txloc[2]; short o_mdt; char o_wcexempt[2]; }
And here is how we marshal the struct. Note that all fields except the double are marshalled without issue. We have the same problem with all our other structs:[StructLayout(LayoutKind.Sequential)] public struct ROtherEarn { public Int16 o_id; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] public String o_desc; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public String o_tpind; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] public String o_payee; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] public String o_addr1; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] public String o_addr2; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] public String o_addr3; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public String o_hours; **public Double o_amt1;** public Int16 o_dept; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public String o_txficas; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public String o_txficam; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public String o_txfit; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public String o_txfuta; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public String o_txsit; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public String o_txsuta; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] public String o_txloc; public Int16 o_mdt; [MarshalAs(Unmanage
-
Button hotkeys not showingThe problem is that hiding the hotkeys is the default behavior in Windows 2000/XP (so the users don't "want it", they just don't know any better). We also have hundreds of clients who are relatively computer illiterate, and think they can't use the keyboard to access all buttons (which they can). Since hotkeys are always visible in Office, Outlook, Mozilla, and many other applications under XP/2000, it is difficult to believe that Microsoft and others are spending the time to create new controls or owner drawn windows just to enable hotkeys to be visible ... seems more likely that there is an application setting somewhere. Thoughts? Josh Lindenmuth Paytime, Inc. jlindenmuth@paytimepayroll.com
-
Button hotkeys not showingHow can we ensure that menu and button accelerators (&) are displayed when the dialog or application are created? Our application only shows the underlined characters after the ALT key is pressed. On the menu, the underlined characters go away, but on the dialog they stay. We'd like the underlines to always show up. This seems to be an application-wide setting. For example, notepad and internet explorer 6 don't show the underlined characters until the ALT key is pressed. Mozilla and Outlook do. I know that this is a display setting in XP/2000, but there has to be some work-around since all the office programs have persistent underlines for the hotkeys. Thank you, Josh Lindenmuth Paytime, Inc. jlindenmuth@paytimepayroll.com