Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm not talking methods or properties, but in effeciency.

 

Just like you shouldn't make a tetris game using 1,000 pictureboxes, apparently some controls are created for a reason.

 

In fact, what can the label do that the textbox cannot already do? So there must be a good reason why it's the preferred control for displaying text.

 

I'm into this because in the MCAD book it's showing you how to properly use controls and in this example, it's using textboxes setting their ReadOnly property to True to display 11 different results.

 

Why?

 

I'm not sure that it's "wrong", but is it really the best practices MS should be teaching?

 

wouldn't it be more resource effecient to use labels set with a 3d border and change their backcolor to look like textboxes if that's what you wanted?

  • Administrators
Posted
Generally speaking if the text is to be readonly and just for display purposes (i.e. no need to copy either) then labels would seem the obvious choice. If you may need to select the text or there could be a requirement for the data to be edited then use a textbox.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
I would assume labels use more resources than textbox's. Textbox's also resemble what alot of people are used to in terms of "forms" etc... In theory I believe they are the same just easier for people to use.

I think it would be the opposite.

 

Labels just display text.

 

Textboxes display, allow you to select, input, type, multiline collections, etc.

  • *Experts*
Posted

In the past, a label wasn't a true control - they didn't have window handles for example. In Windows terms, a label *used* to be just something the compiler drew for you. But now that labels have window handles, I assume they're a lot more "intense" than they used to be. Meaning, they're taking up GDI resources (window handles).

 

In general, a textbox would probably be handling a lot more windows messages as well, even if YOUR code doesn't use them.

 

I wouldn't let that sway you too much. In general think of it like this "if I can use a label, use a label". Only if the label doesn't give you what you want should you use the textbox.

 

-ner

"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
Posted

I wouldn't let that sway you too much. In general think of it like this "if I can use a label, use a label". Only if the label doesn't give you what you want should you use the textbox.

 

-ner

Thats what I figure. MCAD book is making the GUI for a Doughnut Shop. I'm not sure if it builds on this and eventually uses them as a textbox or not.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...