Archive

Author Archive

How to Text Wrap a Label in WPF?

January 26th, 2010 joy No comments

WPF does not allow text wrapping for label control.Thus to wrap a label with a fixed width,we have to place the TextBlock control inside the label control and set its TextWrapping property to “Wrap”.

<Label Width=”50″>
<TextBlock TextWrapping=”Wrap”> I am label with width 50</TextBlock>
</Label>

Popularity: 8% [?]

Categories: C#, WPF Tags:

How to set border color of a panel in c#

December 7th, 2009 joy No comments

In c# for panel there no property to set border color directly.We can only set the border style using BorderStyle.

To set the border color of a panel,

Step 1 : Set BorderStyle property to None.

Step 2 : Draw a rectangle and set the pen color in paint event of the panel

private void panelpanelbordercolor1_Paint(object sender, PaintEventArgs e)
{
  e.Graphics.DrawRectangle(Pens.Red,
  e.ClipRectangle.Left,
  e.ClipRectangle.Top,
  e.ClipRectangle.Width - 1,
  e.ClipRectangle.Height -1);
  base.OnPaint(e);
}

Source Link

Popularity: 9% [?]

Categories: C# Tags: ,

How To Call a Button Click From Another Button in c#

November 8th, 2009 joy No comments

If there is a requirement for calling a button click event from another button in c#, there is a easy way to do.We just need to call the PerformClick Method of the button to be fired.

private void button1_Click(object sender, EventArgs e)
{
    button2.PerformClick();
}
 
private void button2_Click(object sender, EventArgs e)
{
    System.Windows.Forms.MessageBox.Show("I am called from button1");
}

Popularity: 6% [?]

Make Textbox Number Only – WPF

September 28th, 2009 joy No comments

Coding :

private void txt_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !ValidNumeric(e.Text);
base.OnPreviewTextInput(e);
}
 
bool ValidNumeric(string str)
{
bool ret = true;
 
int l = str.Length;
for (int i = 0; i &lt; l; i++)
{
char ch = str[i];
ret &= Char.IsDigit(ch);
}
 
return ret;
}

Thanks dedjo

Popularity: 6% [?]

Categories: C#, WPF Tags: ,

Search Icons for web designing – Icon Finder

August 16th, 2009 joy No comments

Icon Finder is  a place where there are huge collections of icons for web designing.

logo-large

Features :-

  • Collections of  107,536 icons
  • Browse 186 icons sets
  • Icons can be downloaded in “png” or “ico”  format.
  • We can search for icons with different sizes and background colors

Popularity: 3% [?]

Categories: Internet, Tech Stuff Tags: ,

How to open Immediate Window In VS 2005- Shortcuts

July 19th, 2009 joy No comments

The Immediate window is used to debug and evaluate expressions, execute statements, print variable values etc.The Immediate window also supports IntelliSense.There are different methods to open Immediate window.

Method 1 : -
We can open Immediate Window from debug menu.

Debug->Windows->Immediate Window

immediate

Some times Immediate Window menu would be missing.If it seems to be missing for you then you can get the Immediate Window menu by going to Tools->Customize and then select the Commands tab, choose for Debug commands and drag Immediate onto the toolbar.Read more about this issue here.

Method 2 : -

Use the Keyboard Shortcut keys Ctrl+Alt+I

Method 3 : -
We can also open Immediate Window through VS Command window.Just type “immed” in the prompt and hit enter Immediate Window will open.

commimmed

For more details about Immediate Window go to MSDN Link

Popularity: 5% [?]

Categories: Asp.net, Visual Studio Tags: , ,

Easy Trick To Search for Attachments in Gmail – has:attachment

July 17th, 2009 joy No comments

When there are hundreds of mail in our Gmail account and we are in need of mails with attachment and want it to find quickly.Then there is a easy trick in Gmail.

has:attachment

has:attachment

just type has:attachment and the type of the file like pdf,ppt,doc,zip with a space.

Example :-

has:attachment pdf

When we click the search mail button we get the mails with the attachment of the type we specified as the result.Here in this example we get the PDF attachment mails as result.

There are also many easy tricks to find a specified mail in gmail like “has:attachment” keyword.You can find the list here.

Popularity: 1% [?]

Categories: Tech Stuff, Tips And Tricks Tags:

500 Internal Server Error – How We Fixed – Wordpress – Dreamhost

June 27th, 2009 joy No comments

Problem : Internal Server Error 500

Yesterday(Jun-26-2009) our blog was down and got the internal server error 500.So we immediately mailed Dreamhost(our host) support to see the issue and got a support ticket.

We Checked the  error log  which was stating “Premature end of script headers: index.php” error for every hit made.We came to know many had this problem previously in their sites mostly due to some script error in the plugin installed in wordpress.

While waiting for support reply we started to search the web for some solution about internal server error 500 and 503.

We followed some suggestion to solve error 500 like : -

1. Rename wp-cache-config.php

2. Disable the plugins.This we cant do because wordpress was installed in the root folder which made impossible to login and disable the plugins through web interface.

3. Just click Change fully hosted settings actually without making any changes in dreamhost panel

Unfortunately these didn’t work for us.

Today(Jun-27-2009) morning we got the reply mail from dremhost as

I was looking through your error logs and I found one issue that definitely could contribute to the 500 errors that you’re experiencing:

[Fri Jun 26 12:40:29 2009] [notice] mod_fcgid: too much  /home/fordevs/fordevs.com/index.php process(current:4, max:4), skip the spawn request

These errors can be contributed to several things:

1.) Plugins or extensions that are causing the site to load ineffectively, this is common with 3rd party scripts as they are   generally poorly coded.

2.) Your over all site is maxing out the allocated amount of RAM for your user. Unfortunately for security reasons we can’t reveal the amount available to each user, but this could be a contribution to the error.

How we solved the issue?

As the support mail also says it may be due to plugin we decided to solve it ourselves taking the suggestion from a forum discussion .We backed up the plugin folder from webftp and deleted all the plugin there.

After deleting the plugins the site was working fine.We could not exactly say which pulgin made the mess.

If you get the same error just try this but cant assure this method will work for you.

Popularity: 14% [?]

Categories: Internet, Tips And Tricks Tags: ,

How to Get The List Of All Tables in a Database – Sql Server 2005

June 22nd, 2009 joy No comments

We a can get the list of all tables of a database in different ways : -

1.

SELECT *
FROM sys.TABLES

2.

SELECT *
FROM sysobjects
WHERE TYPE='U'

3.

SELECT *
FROM information_schema.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'

Popularity: 3% [?]

Categories: Sql Server Tags:

View Existing Triggers – Drop One or More Triggers in Sql Server 2005

June 19th, 2009 joy No comments

To view the existing triggers in the database

SELECT * FROM sys.triggers
OR
SELECT * FROM sysobjects WHERE xtype='TR'

To view the existing triggers in a specified table

sp_helptrigger tablename

To drop a trigger

DROP TRIGGER triggername

To drop more triggers at a time

DROP TRIGGER [trigger1],[trigger2],[trigger3]...[triggern]

Popularity: 4% [?]

Categories: Sql Server Tags: