Guest makai Posted November 30, 2002 Posted November 30, 2002 OK - I put a label on a form in C# - then I added this code (the event code was added automatically simply by clicking the label in the designer) I just added label1.text = "test";: private void label1_Click(object sender, System.EventArgs e) { label1.text = "test"; } incredibly the project will not build - it underlines label1.text and says: 'System.Windows.Forms.Control.text' is inaccessible due to its protection level. can someone tell me what is going on and how to make it work? Quote
Guest makai Posted November 30, 2002 Posted November 30, 2002 sorry - I tried it again and it worked the 2nd time Quote
AllanW Posted January 24, 2003 Posted January 24, 2003 I had the same problem for a second. The problem is that you have to capitalize the 'T' in the Text: label1.Text = "test"; Quote
Moderators Robby Posted January 25, 2003 Moderators Posted January 25, 2003 The Intellisense in C# is not as intelligent as in VB.NET. You need to pay more attention as you type. Quote Visit...Bassic Software
*Experts* Nerseus Posted January 25, 2003 *Experts* Posted January 25, 2003 I think it's the same in both, it's just that VB.NET isn't case-sensitive whereas C# is. It can be a pain if you don't know what's going on :) I use the Tab key to have intellisense auto-complete for me and it adjusts capitalization automatically. Another trick is to press Ctrl-Space to have the autocomplete either fill in the rest of your word, or bring up the intellisense drop-down so you can pick what you want (and press tab to have it fill it in). I got used to that in VB6 and it's worked wonders ever since. -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
*Experts* Volte Posted January 25, 2003 *Experts* Posted January 25, 2003 Actually, C#'s intellisense isn't as intelligent as VB's; for example, the using statement doesn't invoke the the intellisense, while Imports in VB.NET does. Also, in some cases when working with classes, this, among other things, don't have intellisense either. Apparently this is fixed in VB.NET 2003. Quote
*Experts* Nerseus Posted January 25, 2003 *Experts* Posted January 25, 2003 Fixed in VB.NET? You mean C# 2003, or were you being sarcastic in that is now *doesn't* work in VB.NET 2003? I've never had trouble using intellisense with "this". You're right about "using" not having intellisense, but only for the first word. Since you use "System" about 99% of the time, it's not such a big deal but it is kind of a pain :) You can also press Ctrl-Space to bring up a list of "using" references, but not many people know about it or want to use it :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Moderators Robby Posted January 25, 2003 Moderators Posted January 25, 2003 Yeah, Ctrl-Space will complete the word, but at least in VB when you move off the line, it will correct the case as well as the indents, C# does not. Also, if you have compile errors in C#, then as you fix those errors, the blue line is still there (until you recompile). Oh, one thing I do prefer in C# is that it will point out (blue line) unused variables. Quote Visit...Bassic Software
*Experts* Volte Posted January 25, 2003 *Experts* Posted January 25, 2003 Heh, oops, I meant VS.NET, not VB.NET. But aside from using, there are still some inconsistencies, which make life harder. I can't tell you of any right off the top of my head, but I do know that there are more; it drove me crazy when making a game with GDI+ in C#. Let me open C# to find some... ... Ok, here is a major one for me; no autolisting of constants. I type this.DrawMode = in C#. Nothing happens. No intellisense list of possible draw modes, so I have to type 'System.Drawing.DrawModes' or whatever the constant is in order to get the list. In VB.NET I type Me.DrawMode = and a list of possible constants pops up. Quite a big pain. Another is that is doesn't do as-you-type error checking for anything other than structure. I typeDrawing.Graphics g; g.MeasureString(a,b,c,d,e)and there are no errors. Aside from the fact that none of those variables exist, there aren't that many parameters in MeasureString. Quote
Moderators Robby Posted January 25, 2003 Moderators Posted January 25, 2003 Yeah, and it will only tell you when you try and compile, and as I said earlier, the blue error line will still be there after you have fixed it. Quote Visit...Bassic Software
*Gurus* divil Posted January 25, 2003 *Gurus* Posted January 25, 2003 As Volte said, supposedly the Intellisense in C# in VS.NET 2003 has been brought up to par with VB's :) Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Moderators Robby Posted January 25, 2003 Moderators Posted January 25, 2003 Are any of you gonna pick it up? Quote Visit...Bassic Software
*Experts* Volte Posted January 25, 2003 *Experts* Posted January 25, 2003 Well, it's supposedly going to be a very inexpensive upgrade for people who already own the first .NET, so yeah. :) Quote
Moderators Robby Posted January 25, 2003 Moderators Posted January 25, 2003 I heard it's going to cost $25. ?? Quote Visit...Bassic Software
*Gurus* divil Posted January 25, 2003 *Gurus* Posted January 25, 2003 I heard $30. Something in that region, definitely. For registered owners of VS.NET, anyway. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.