By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,011 Online
Bytes IT Community
Submit an Article
Got Smarts?
Share your bits of IT knowledge by writing an article on Bytes.

.NET Tips and Tricks

Frinavale
Expert Mod 5K+
P: 9,731
Edit
Many times we spend hours and hours trying to solve a problem. When we finally figure it out, we want to share it to keep others from suffering the same way!

That's why we have this "Tips and Tricks" thread. Post your solutions and tricks that you think will help someone down the road here.

If the tip is complex or long, you might want to consider making an article out of it and posting it in the Insights forum.

Looking forward to all the helpful tips!

--insertAlias

Note: The following was the old thread in the answers forum. I am merging it here for convenience.
/Edit

Frinny's Tip O' The Week
Many of us find our way to Bytes.com seeking help while we're facing a programming problem. Sometimes we just need a pointer to get us going in the right direction.

I've started this thread to provide tips and "how-tos" on common problems that everyone faces. Some of these posts will be provided by me (Frinny) but other's will be selected according to how important and informative the posts are.

I hope you'll find something useful here!

---------------------------------------------------------------------------------------------------------------

The 3rd Week of April 2007:
How To Use Databases:
.................................................. .........................................

The 2nd Week of May 2007:
Sessions:
The 3rd Week of May 2007:
Send E-mails: The 4th Week of May 2007:
Faxes:The 5th Week of May 2007:
Checking TextBoxes for a Number:.................................................. .........................................

The 1st Week of August 2007:
The.Net Framework:
The 3rd Week of August 2007:
Reports:
The 4th Week of August 2007:
Connection Pooling:.................................................. .........................................


The 1st Week of September 2007:
Master Pages:

The 3rd Week of September 2007:
GridViews:
.................................................. .........................................

The 4th Week of May 2009:
Asp.NET Life Cycle: .................................................. .........................................
Apr 21 '07 #1
Share this Article
Share on Google+
8 Comments


sashi
Expert 100+
P: 1,754
Hi Frinny,

Great work, keep it up. Good luck & Take care.
Jun 27 '07 #2

Curtis Rutland
Expert 2.5K+
P: 3,256
I've moved this thread here and resurrected it so we can start posting our helpful tips and tricks. Anything that you figure out that you think may help someone else is welcome here.

Just add a comment with your tip!

Thanks
--insertAlias
Dec 12 '08 #3

balabaster
Expert 100+
P: 797
Ben's Tip o' the day:

Always save your work before you go home at night and don't expect that your computer won't have rebooted itself by the time you come into work the next morning!
Dec 12 '08 #4

Curtis Rutland
Expert 2.5K+
P: 3,256
Well, I've recently discovered how to hide the caret (cursor) in a textbox.

Expand|Select|Wrap|Line Numbers
  1. [DllImport("user32")]
  2. private static extern bool HideCaret(IntPtr hWnd);
Then, write an event handler for the "Enter" event for the textbox, and use the handle of the textbox. Like this:
Expand|Select|Wrap|Line Numbers
  1. private void tbOutput_Enter(object sender, EventArgs e)
  2. {
  3.     HideCaret(tbOutput.Handle);
  4. }
Jan 11 '09 #5

P: 1
An elegant way to parse Enums in C#: http://ko-sw.blogspot.com/2009/03/el...e-c-enums.html
Mar 26 '09 #6

Frinavale
Expert Mod 5K+
P: 9,731
Conversion Chart for C# to VB scope modifiers:
Expand|Select|Wrap|Line Numbers
  1. -------------------------------------------------------
  2.    C#               |    VB
  3. -------------------------------------------------------
  4. public              |  Public
  5. protected           |  Protected
  6. private             |  Private
  7. internal            |  Friend
  8. internal protected  |  Protected Friend
  9. static              |  Shared
  10. const               |  Const
  11. -------------------------------------------------------
Jul 1 '09 #7

Frinavale
Expert Mod 5K+
P: 9,731
A website that helps compare/translate VB.NET -> C#:

VB.NET and C# Comparison
Oct 20 '09 #8

P: 6
Vertical progress bar
------------------------------------------------------------
Derive your class as shown below
Expand|Select|Wrap|Line Numbers
  1. class VertProgress : ProgressBar
  2. {
  3.       override CreateParams CreateParams
  4.       {
  5.            get
  6.            {
  7.                  CreateParams crParam = base.CreateParams;
  8.                  crParam.Style |= 0x04;
  9.                  return crParam; 
  10.            }
  11.        }
  12. }
Once you build your application, in the toolbar you will see VertProgress. Drag and drop it in the windows form. Strech it vertically.
Oct 30 '09 #9