Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Programming Talk / VB / VB.net - Compiler warning : 'Access of shared Member'

Author
Message
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 22nd Dec 2005 13:24
Currently using VB 2005, and with the following code :

If userDetails.ShowDialog(Me) = DialogResult.Cancel Then
Return True
End If

warning BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated, with the problem being DialogResult. Whilst the warning can be ignored, I would like to know how to check what button was pressed on the form, and it doesn't seem to like reading from DialogResult.

1tg46
21
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 23rd Dec 2005 21:43
If you have a pre-version of VB.NET 2005 and not the latest release of it, it may be a bug. Otherwise, I don't know what to tell you. A possible solution would be to have an integer value instead of an enum value, becuase all enums are integer based.

Try something like:

If userDetails.ShowDialog(Me) = 0 Then
Return True
End If

I am not sure on the integer of each DialogResult enum item.


Regards,
1tg46

Reality is an illusion brought on by the absence of alcohol - this is not a literal statement

Look for me at The Code Project
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Dec 2005 01:50
evaluate the dialog result after the showdialog() and define user details as friend at the form level

dim fMyForm as New frmWhateverMyFormNameIsInDesigner()
dim UDRet as WhateverType

fMyForm.ShowDialog

'//the user will do whatever to your friend var at that form

if fMyForm.DialogResult <> DialogResult.Cancel Then
'//UDRet=fMyForm value or similar here
'//even tho form is visually closed its not out of scope until this method is out of scope
End If

SORRY UR NOT COMEDIAN
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 6th Jan 2006 16:02
Ah right - I'll try that.

I'm using the released version of 2005, by the way.

Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Smoke me a computer chip, I'll be baking breakfast.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 9th Jan 2006 15:27
Even with that, it didn't, so ended up having to use System.Windows.Forms.DialogResult.OK

Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Smoke me a computer chip, I'll be baking breakfast.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Jan 2006 23:21


(my caps-lock is off!)

SORRY UR NOT COMEDIAN
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 10th Jan 2006 12:34
Its one of the many things I dont like about Visual Basic (apart from the fact that it exists) - a lot of things about it make no real sense.

Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Smoke me a computer chip, I'll be baking breakfast.
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 11th Jan 2006 16:50
VB6 was a lot less mean(ingless?) with that kind of thing. It didn't care whether you were using a 'shared' copy or an 'instance', it'd just do the job.

But VB.Net actually makes sense with error messages, and is really, really high-level. I remember the Beta version of vb 2k5, when you installed the MSDN one of the few 'chapters' in there was called 'Upgrading from Visual Studio 6'....

Support the AAANJL by doing nothing! Visit teh site below..
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 12th Jan 2006 00:40
I just find that it all seems so long winded. The only reason for using it is because, Sage,in their infinite wisdom decided to drop C interfaces - and I'm not going to try to do it without support from Sage (which they won't give).

Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Smoke me a computer chip, I'll be baking breakfast.

Login to post a reply

Server time is: 2025-06-01 09:37:20
Your offset time is: 2025-06-01 09:37:20