Click to See Complete Forum and Search --> : need help on text format
redfox
04-04-2006, 02:19 AM
any help would be super,
this is the current sample:
please help me with my problem please
now this is what i want my label or textbox to display:
p h m w m p p
l e e i y r l
e l t o e
a p h b a
s l s
e e e
m
is it possible, please help me
sirpelidor
04-04-2006, 05:01 PM
off the top of my head, this is how I would do it, hope it will be good enough to get you to start (remember, this is not a tight code, so you will need to modify it a little to minimize additional memory resources)
-To keep things simple, lets say the longest length of your word is 10 chars:
char [] wordAry = new char[9];
-And when you have a string (less or equal then 10 chars) call wordString, you want to write to the wordAry array:
for (int i=0;i< wordAry.length();i++){
wordAry(i) = wordString.subString(i);
}
-make yourself a collection (lets use ArrayList) to hold a collections of your wordAry array.
ArrayList aryLst = new ArrayList();
aryLst.add(wordAry)
-now your aryLst contains x number of wordArys, and each wordArys contain a string of characters, time to loop through them for output:
//say u got a label call lblMsg
for (int i = 0; i < wordAry.length();i++){
lblMsg.Text += formatOutput(i) + "<br>";
}//end for
public string formatOutput(int i){
string formmattedResult;
foreach (wordAry in aryLst){
formattedResult += wordAry[i];
}//end foreach
return formattedResult;
}//end formatOutput
i haven't debug this yet... but the concept is to have 2 collection classes work together, that way you can output your string vertically.
redfox
04-05-2006, 03:28 AM
thanks man for your help, what you did gives me a great deal of idea, thanks a lot man:)