Click here to Skip to main content
15,890,557 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to stop scrolling of form when we scroll any control that has scrollbars? Pin
Sun Rays26-Nov-07 20:05
Sun Rays26-Nov-07 20:05 
QuestionHow to replace very first character only......? Pin
Pankaj - Joshi26-Nov-07 19:01
Pankaj - Joshi26-Nov-07 19:01 
AnswerRe: How to replace very first character only......? Pin
stancrm26-Nov-07 19:59
stancrm26-Nov-07 19:59 
AnswerRe: How to replace very first character only......? Pin
Andrei Ungureanu26-Nov-07 20:04
Andrei Ungureanu26-Nov-07 20:04 
GeneralRe: How to replace very first character only......? Pin
Pankaj - Joshi26-Nov-07 21:34
Pankaj - Joshi26-Nov-07 21:34 
AnswerRe: How to replace very first character only......? Pin
Sun Rays26-Nov-07 20:11
Sun Rays26-Nov-07 20:11 
GeneralRe: How to replace very first character only......? Pin
Pankaj - Joshi26-Nov-07 21:35
Pankaj - Joshi26-Nov-07 21:35 
GeneralRe: How to replace very first character only......? Pin
Sun Rays26-Nov-07 22:07
Sun Rays26-Nov-07 22:07 
Pankaj - Joshi wrote:
public static string getNewItemName(string actualItemName, string saparaterCharacter)
{
string valueToReturn = "";
try
{
int ipos = actualItemName.ToString().IndexOf(saparaterCharacter.ToString());
if (ipos > -1) //That means saparator is not found...
{
if (saparaterCharacter.ToString().Length == 0)
valueToReturn = actualItemName.ToString();
else
{
string strFirstPart = actualItemName.ToString().Substring(0, ipos).ToString();
string strSecondPart = "";
if (actualItemName.ToString().Length == 0)
strSecondPart = actualItemName.ToString().Substring(ipos).ToString();
else
strSecondPart = actualItemName.ToString().Substring(ipos + 1).ToString();

valueToReturn = strFirstPart + ":" + strSecondPart;
}
}
else
valueToReturn = actualItemName.ToString();
}
catch (Exception)
{
//In Case of any error we are returning the same name
valueToReturn = actualItemName.ToString();
}
return valueToReturn;
}


Hi,
here before checking anything you have to check that
if(str.Length > 0)
{
if(str.Contains("-"))
{
// here write everything.. will not give any error.
}

}

Thanks,
Sun Rays

To get something you must have to try once.


My Articles

AnswerRe: How to replace very first character only......? Pin
KennyPatel26-Nov-07 21:12
KennyPatel26-Nov-07 21:12 
AnswerRe: How to replace very first character only......? Pin
KennyPatel26-Nov-07 21:14
KennyPatel26-Nov-07 21:14 
AnswerRe: How to replace very first character only......? Pin
KennyPatel26-Nov-07 21:15
KennyPatel26-Nov-07 21:15 
AnswerRe: How to replace very first character only......? Pin
KennyPatel26-Nov-07 21:18
KennyPatel26-Nov-07 21:18 
AnswerRe: How to replace very first character only......? Pin
Luc Pattyn27-Nov-07 1:58
sitebuilderLuc Pattyn27-Nov-07 1:58 
AnswerRe: How to replace very first character only......? Pin
PIEBALDconsult27-Nov-07 10:33
mvePIEBALDconsult27-Nov-07 10:33 
AnswerRe: How to replace very first character only......? [modified] Pin
PIEBALDconsult27-Nov-07 13:33
mvePIEBALDconsult27-Nov-07 13:33 
QuestionMasked Formating Pin
Shaahinm26-Nov-07 18:58
Shaahinm26-Nov-07 18:58 
AnswerRe: Masked Formating Pin
Michael Sync26-Nov-07 19:22
Michael Sync26-Nov-07 19:22 
GeneralRe: Masked Formating Pin
Shaahinm26-Nov-07 19:28
Shaahinm26-Nov-07 19:28 
GeneralRe: Masked Formating Pin
Michael Sync26-Nov-07 19:50
Michael Sync26-Nov-07 19:50 
QuestionWrapping a text in textbox Pin
anu8126-Nov-07 18:52
anu8126-Nov-07 18:52 
AnswerRe: Wrapping a text in textbox Pin
Michael Sync26-Nov-07 19:21
Michael Sync26-Nov-07 19:21 
GeneralRe: Wrapping a text in textbox Pin
anu8126-Nov-07 19:40
anu8126-Nov-07 19:40 
GeneralRe: Wrapping a text in textbox Pin
Michael Sync26-Nov-07 20:08
Michael Sync26-Nov-07 20:08 
GeneralRe: Wrapping a text in textbox Pin
anu8126-Nov-07 20:22
anu8126-Nov-07 20:22 
Questionabout develope scheme Pin
jason_mf26-Nov-07 17:49
jason_mf26-Nov-07 17:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.