Groups | Blog | Home
all groups > asp.net > march 2005 >

asp.net : adding local varialbes - String?


Patrick Olurotimi Ige
3/30/2005 11:56:27 PM
I have a DataTable:-
private void CreateForm(DataTable dt, string headerText)
{
}

string formTitle = tbxFormTitle.Text;
string formNotes = tbxFormnotes.Text;
DataTable dtForm = GetDataTable(formSql);

And i'm calling 2 local variable
dtForm,formTitle

Like so
CreateForm(dtForm,formTitle);
How can i add a 3rd one for example the string formNotes?


Hitesh
3/31/2005 5:05:09 AM
Either you can overload the CreateForm method to have one more parameter or
you can use string concatenation and add the thrid string with the second
string iteself seprated with and character(say #) and in the CreateForm
method you can again seprate back the two strings.

Hope this helps.

[quoted text, click to view]
Patrick Olurotimi Ige
3/31/2005 5:03:28 PM
Hitesh..
Can you post me a sample!



Hitesh
3/31/2005 9:59:05 PM
Sample for the override method:
private void CreateForm(DataTable dt, string headerText, string headerNotes)
{
}

and make a call like this:
CreateForm(dtForm,formTitle,formNotes);

Sample for string concatenation:

formTitle += "#" + formNotes;
call in the same way as you are doing
CreateForm(dtForm,formTitle)

and in the method do this way:

private void CreateForm(DataTable dt, string headerText)
{
string formNotes = "';
//some verification here like whether there is any text after the # in the
headerText variable

if(headerText.Length > headerText.IndexOf("#") + 1)
formNotes = headerText.Substring(headerText.IndexOf("#")+1);

//do the normal processing here
}




[quoted text, click to view]
AddThis Social Bookmark Button