Code Red > .NET
Windows Form Application vs Class Library Application and Userforms
fxcastil:
I created a Windows Form application and Class Library application with one UserForm and One module.
The UserForm name is formTest it contains one textbox.
The Useform is a PUBLIC class in both applications.
I can use ( formTest.TextBox1.Text = "hello" ) in the Windows Form Application but not in the Class Library Application.
Why the difference ???
--- Code: ---
Option Explicit On
Option Strict On
Module Mod_Test
Sub test()
formTest.TextBox1.Text = "hello"
End Sub
End Module
--- End code ---
TT:
--- Quote from: fxcastil on August 10, 2012, 04:09:28 pm ---I created a Windows Form application and Class Library application with one UserForm and One module.
The UserForm name is formTest it contains one textbox.
The Useform is a PUBLIC class in both applications.
I can use ( formTest.TextBox1.Text = "hello" ) in the Windows Form Application but not in the Class Library Application.
Why the difference ???
--- Code: ---
Option Explicit On
Option Strict On
Module Mod_Test
Sub test()
formTest.TextBox1.Text = "hello"
End Sub
End Module
--- End code ---
--- End quote ---
I'm going to assume you're new to VB and or .NET.
You don't show the code in the Winforms Application, only the code from the classlibarary project.
Could it be that the code in the winforms application is in the formTest class?
If so, then the reason it works is because it is a member of the formTest class, and has access to non-public members of that class. The TextBox1 member variable in your form is most-likely declared as Private, which means it is not visible to code outside of the formTest class.
fxcastil:
--- Quote ---You don't show the code in the Winforms Application, only the code from the classlibarary project.
Could it be that the code in the winforms application is in the formTest class?
If so, then the reason it works is because it is a member of the formTest class, and has access to non-public members of that class. The TextBox1 member variable in your form is most-likely declared as Private, which means it is not visible to code outside of the formTest class.
--- End quote ---
I have created a seperate module, in both applications. Both applications have the same modue (Mod_Test) in which the code resides.
The userforms are the same in both applications, the userform is a public class.
I have double checked the userform of both application to ensure they are identical.
I can't access the properties (buttons and other controls ) of a public class userform in the seperate module of the Class Library Application.
Kerry:
Perhaps you should post the full solution.
.. or a cut down version that displays the problem you are having.
fxcastil:
Here are the two projects
Navigation
[0] Message Index
[#] Next page
Go to full version