Click here to Skip to main content
15,900,906 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: How come I can call Public Methods of a Form as if they were Shared? Pin
Sander Rossel11-May-11 10:27
professionalSander Rossel11-May-11 10:27 
GeneralRe: How come I can call Public Methods of a Form as if they were Shared? Pin
Dave Kreskowiak11-May-11 10:56
mveDave Kreskowiak11-May-11 10:56 
GeneralRe: How come I can call Public Methods of a Form as if they were Shared? Pin
Sander Rossel11-May-11 11:09
professionalSander Rossel11-May-11 11:09 
GeneralRe: How come I can call Public Methods of a Form as if they were Shared? Pin
Luc Pattyn11-May-11 12:41
sitebuilderLuc Pattyn11-May-11 12:41 
AnswerRe: How come I can call Public Methods of a Form as if they were Shared? Pin
Eddy Vluggen11-May-11 10:44
professionalEddy Vluggen11-May-11 10:44 
GeneralRe: How come I can call Public Methods of a Form as if they were Shared? Pin
Sander Rossel11-May-11 11:05
professionalSander Rossel11-May-11 11:05 
GeneralRe: How come I can call Public Methods of a Form as if they were Shared? Pin
Eddy Vluggen11-May-11 11:34
professionalEddy Vluggen11-May-11 11:34 
GeneralRe: How come I can call Public Methods of a Form as if they were Shared? Pin
MicroVirus30-May-11 4:55
MicroVirus30-May-11 4:55 
In what way is encapsulation broken? The only problem I can see with this is that if you wanted your constructor to be private then this would ruin it for you. Other than that, normal class access rules still apply.
VB.NET just acts like you declared Dim Form1 As New Form1. So the first call to a non-shared member of Form1 causes a new instance of Form1 to be created. But then, you wouldn't normally be calling non-shared members on the class anyway, so all in all the problem is fairly limited (that is to say: if you wrote your code without knowing this quirk, you wouldn't ever find out about it, because you wouldn't be directly accessing members through Form1 but via an instance).

That is not to say that I at all agree with this. I hated this quirk in VB6 already, as it was more confusing than anything. Completely unintuitive and destructive to the idea of classes and OOP for new programmers if they see this behaviour
AnswerRe: How come I can call Public Methods of a Form as if they were Shared? Pin
CS140124-Jun-11 0:53
CS140124-Jun-11 0:53 
GeneralRe: How come I can call Public Methods of a Form as if they were Shared? Pin
Sander Rossel24-Jun-11 7:58
professionalSander Rossel24-Jun-11 7:58 
QuestionOnly one Exe at an instance Pin
pix_programmer23-Apr-11 6:19
pix_programmer23-Apr-11 6:19 
AnswerRe: Only one Exe at an instance Pin
Luc Pattyn23-Apr-11 7:18
sitebuilderLuc Pattyn23-Apr-11 7:18 
AnswerRe: Only one Exe at an instance Pin
Shameel26-Apr-11 2:00
professionalShameel26-Apr-11 2:00 
QuestionHow can i create a receipt(size 400*400) in crystal report C# 2.0 windows application [modified] Pin
Member 436368017-Apr-11 20:14
Member 436368017-Apr-11 20:14 
AnswerRe: How can i create a receipt(size 400*400) in crystal report C# 2.0 windows application Pin
thatraja7-Jun-11 1:15
professionalthatraja7-Jun-11 1:15 
QuestionWindows 7 doest launch application on startup Pin
Xmen Real 17-Apr-11 3:06
professional Xmen Real 17-Apr-11 3:06 
AnswerRe: Windows 7 doest launch application on startup Pin
RobCroll17-Apr-11 4:46
RobCroll17-Apr-11 4:46 
GeneralRe: Windows 7 doest launch application on startup Pin
Xmen Real 17-Apr-11 5:22
professional Xmen Real 17-Apr-11 5:22 
GeneralRe: Windows 7 doest launch application on startup Pin
Dave Kreskowiak17-Apr-11 5:37
mveDave Kreskowiak17-Apr-11 5:37 
GeneralRe: Windows 7 doest launch application on startup Pin
Xmen Real 17-Apr-11 5:42
professional Xmen Real 17-Apr-11 5:42 
GeneralRe: Windows 7 doest launch application on startup Pin
Luc Pattyn17-Apr-11 6:07
sitebuilderLuc Pattyn17-Apr-11 6:07 
GeneralRe: Windows 7 doest launch application on startup Pin
Xmen Real 17-Apr-11 6:12
professional Xmen Real 17-Apr-11 6:12 
GeneralRe: Windows 7 doest launch application on startup Pin
Luc Pattyn17-Apr-11 6:24
sitebuilderLuc Pattyn17-Apr-11 6:24 
GeneralRe: Windows 7 doest launch application on startup Pin
Xmen Real 17-Apr-11 6:26
professional Xmen Real 17-Apr-11 6:26 
GeneralRe: Windows 7 doest launch application on startup Pin
Dave Kreskowiak17-Apr-11 8:39
mveDave Kreskowiak17-Apr-11 8:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.