Click here to Skip to main content
15,922,155 members
Home / Discussions / C#
   

C#

 
QuestionRestricting Form-Moving to horizontal? Pin
jkersch11-Aug-04 4:17
jkersch11-Aug-04 4:17 
AnswerRe: Restricting Form-Moving to horizontal? Pin
Not Active11-Aug-04 4:58
mentorNot Active11-Aug-04 4:58 
GeneralRe: Restricting Form-Moving to horizontal? Pin
jkersch11-Aug-04 5:14
jkersch11-Aug-04 5:14 
GeneralXmlValidatingReader Pin
Not Active11-Aug-04 3:59
mentorNot Active11-Aug-04 3:59 
GeneralRe: XmlValidatingReader Pin
VenkatFor.NET11-Aug-04 7:28
VenkatFor.NET11-Aug-04 7:28 
GeneralRe: XmlValidatingReader Pin
Not Active12-Aug-04 3:57
mentorNot Active12-Aug-04 3:57 
QuestionDo you see the same results??? Pin
LongRange.Shooter11-Aug-04 3:13
LongRange.Shooter11-Aug-04 3:13 
AnswerRe: Do you see the same results??? Pin
Nick Parker11-Aug-04 4:16
protectorNick Parker11-Aug-04 4:16 
theRealCondor wrote:
this.listBox1.Items.Add(texts[i].PadLeft(len));

This is your problem, PadLeft wants the total length, this would include what is already in the string which is why your results vary, each string length is different. The following works for me:

private void button_Click(object sender, EventArgs e)
{
    string[] text = new string[]{"Line One", "Line Two", "Line Three", "Line Four", "Line Five"};
    int len = 10;
    char c = '.';
    for(int i = 0; i < 5; i++)
        box.Items.Add(text[i].PadLeft(len + text[i].Length, c));
}


- Nick Parker
My Blog | My Articles

GeneralRe: Do you see the same results??? Pin
LongRange.Shooter11-Aug-04 5:43
LongRange.Shooter11-Aug-04 5:43 
GeneralDirectX Pin
rafQ11-Aug-04 2:29
rafQ11-Aug-04 2:29 
GeneralUrgent Regarding Directoryentry.Invoke(Setpassword,&quot;&quot;) method Pin
shambho11-Aug-04 2:24
shambho11-Aug-04 2:24 
GeneralRe: Urgent Regarding Directoryentry.Invoke(Setpassword,&quot;&quot;) method Pin
LongRange.Shooter11-Aug-04 3:22
LongRange.Shooter11-Aug-04 3:22 
GeneralRe: Urgent Regarding Directoryentry.Invoke(Setpassword,&quot;&quot;) method Pin
shambho11-Aug-04 18:21
shambho11-Aug-04 18:21 
GeneralRe: Urgent Regarding Directoryentry.Invoke(Setpassword,&quot;&quot;) method Pin
Nick Parker11-Aug-04 3:42
protectorNick Parker11-Aug-04 3:42 
GeneralRe: Urgent Regarding Directoryentry.Invoke(Setpassword,&quot;&quot;) method Pin
shambho11-Aug-04 18:31
shambho11-Aug-04 18:31 
GeneralCommit a Outllook Message automatically using the user32.dll - Problems with the right wNotifiyCode Pin
Member 7812311-Aug-04 1:51
Member 7812311-Aug-04 1:51 
GeneralDataBase Problem Pin
ahegeg@hotmail.com11-Aug-04 1:47
sussahegeg@hotmail.com11-Aug-04 1:47 
GeneralRe: DataBase Problem Pin
VenkatFor.NET11-Aug-04 7:07
VenkatFor.NET11-Aug-04 7:07 
GeneralProblem verifying a signed XML document Pin
pelos11-Aug-04 1:15
pelos11-Aug-04 1:15 
GeneralJodoveepn article printing controls on a form Pin
robmays11-Aug-04 1:07
robmays11-Aug-04 1:07 
QuestionHow to access the object associated with tree nodes tag property? Pin
sachinkalse11-Aug-04 0:20
sachinkalse11-Aug-04 0:20 
AnswerRe: How to access the object associated with tree nodes tag property? Pin
Nick Parker11-Aug-04 2:59
protectorNick Parker11-Aug-04 2:59 
GeneralRe: How to access the object associated with tree nodes tag property? Pin
sachinkalse11-Aug-04 14:55
sachinkalse11-Aug-04 14:55 
GeneralRe: How to access the object associated with tree nodes tag property? Pin
sachinkalse11-Aug-04 16:30
sachinkalse11-Aug-04 16:30 
GeneralPointers,Classes,Objects... II Pin
Tambi Ashmoz11-Aug-04 0:15
Tambi Ashmoz11-Aug-04 0:15 

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.