-
Apr 28th, 2016, 09:12 AM
#1
Thread Starter
Junior Member
Property Access must assign to the property or use its value
Hi,
I created a windows form, then i have another menu kind of windows form to open other windows form. 2 menu button to divert to another windows form is working, only one is not working. I have tried creating a few windows form to test and all results the same. Below is the screenshot, please help. Thanks
-
Apr 28th, 2016, 03:27 PM
#2
Hyperactive Member
Re: Property Access must assign to the property or use its value
sales_report_qnty does not appear to be a proper form. If it was then the .show() method would have auto-capitalized to .Show().
You may have to make backups of the related files, delete it and recreate the form and paste the code back in.
-
Apr 28th, 2016, 08:01 PM
#3
Re: Property Access must assign to the property or use its value
Check the Solution Explorer to see whether that class shows the correct Form icon. I'll wager that it doesn't. Someone solved an issue like this recently but I can't recall which thread it was. I think that, if you open the designer code file for that form and one that's working, you may well be able to see what's missing in the broken one. I think that's what the other person did.
-
May 3rd, 2016, 05:09 AM
#4
Thread Starter
Junior Member
Re: Property Access must assign to the property or use its value
Hi Guys,
As Far as i've checked, everything seems the same, i have deleted and created another windows form and still the same. Let me know if there is any other suggestions. Thanks
-
May 3rd, 2016, 08:19 AM
#5
Re: Property Access must assign to the property or use its value
What happens if you create an instance of that form and show it? Instead of using the default instance, create an explicit instance and see if that works.
-tg
-
May 3rd, 2016, 08:27 AM
#6
Re: Property Access must assign to the property or use its value
Originally Posted by techgnome
What happens if you create an instance of that form and show it? Instead of using the default instance, create an explicit instance and see if that works.
-tg
That's a very good point. Have you, by any chance, added a constructor with one or more parameters to that form without also adding a parameterless constructor? If so then that form will have no default instance because a parameterless constructor is required to create a default instance.
-
May 3rd, 2016, 08:32 AM
#7
Re: Property Access must assign to the property or use its value
What I'm wondering is if there's a problem with the constructor/initialization of the form that prevents the default instance from being created, and so it isn't able to assign the property a value, which would result in the error above. On a side note, I wouldn't have different forms for what appears to be the same report, just with different parameters or groupings... I'd have a single report that could handle it all, but modify itself depending on the parameters. Then I'd simply show that form (or rather an instance of it) passing it the different parameters so it shows correctly ... but then again, I know diddly about the report and am simply going based on the code in the screenshot, I think I'll shaddup now...
-tg
-
May 3rd, 2016, 08:59 AM
#8
Re: Property Access must assign to the property or use its value
Originally Posted by techgnome
What I'm wondering is if there's a problem with the constructor/initialization of the form that prevents the default instance from being created, and so it isn't able to assign the property a value, which would result in the error above.
What you're describing sounds like it would generate a run time error though, rather than a compilation error.
-
May 3rd, 2016, 10:13 AM
#9
Re: Property Access must assign to the property or use its value
Just another straw to clutch at but is it possible you've accidentally removes the "inherits Form" line from the designer code?
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
May 3rd, 2016, 11:00 AM
#10
Re: Property Access must assign to the property or use its value
Talking of straws....
What happens if you right click on the word show and select "Go To Definition" in the context menu? Does it take you to an actual Property definition.... or somewhere else?
-
May 3rd, 2016, 01:16 PM
#11
Re: Property Access must assign to the property or use its value
Originally Posted by jmcilhinney
What you're describing sounds like it would generate a run time error though, rather than a compilation error.
You'd think so, and yet it wouldn't have been the weirdest thing I've seen in VS.
Originally Posted by Inferrd
Talking of straws....
What happens if you right click on the word show and select "Go To Definition" in the context menu? Does it take you to an actual Property definition.... or somewhere else?
Actually, I now wonder if there is a property that's been added to the form called "Show" ... that would cause the compiler to get confused...
-tg
-
May 3rd, 2016, 02:46 PM
#12
Re: Property Access must assign to the property or use its value
Originally Posted by techgnome
Actually, I now wonder if there is a property that's been added to the form called "Show" ... that would cause the compiler to get confused...
That's what I was thinking. A Property definition for show with a small s as seen in the attachment.
Creating a property named show should give a compiler warning, though warnings are easier to miss than errors.
Without the Property definition, "Go To Definition" takes me to the Object Browser in VS2010, and somewhere confusing I've never been before in VS2015.
-
May 4th, 2016, 01:38 AM
#13
Thread Starter
Junior Member
Re: Property Access must assign to the property or use its value
Hi All,
Thanks for your reply, i found the solution. I just change the part below and it worked. Previously it was set as textbox, i changed it to the form name. Thanks
-
May 4th, 2016, 02:34 AM
#14
Re: Property Access must assign to the property or use its value
So, you're saying that you had a TextBox on the form containing the code with the same name as the form you want to open?
-
May 4th, 2016, 02:46 AM
#15
Thread Starter
Junior Member
Re: Property Access must assign to the property or use its value
Hi,
No, the form name and text box not the same, but for some reason, (Im not sure what you call the bar up there) it defaults to textbox name, later i changed it and save, after that it was fine. Thanks
-
May 4th, 2016, 02:49 AM
#16
Re: Property Access must assign to the property or use its value
Originally Posted by carlson_46
Hi,
No, the form name and text box not the same, but for some reason, (Im not sure what you call the bar up there) it defaults to textbox name, later i changed it and save, after that it was fine. Thanks
That doesn't actually make any sense but I guess it's a moot point as what you wanted to work is working and that's what matters.
-
May 4th, 2016, 02:51 AM
#17
Thread Starter
Junior Member
Re: Property Access must assign to the property or use its value
Yup, as long it is working, Im Happy.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|