Click here to Skip to main content
15,795,712 members
Home / Discussions / C#
   

C#

 
AnswerRe: .NET Collections - Capacity Pin
AspDotNetDev25-Apr-11 12:10
protectorAspDotNetDev25-Apr-11 12:10 
GeneralRe: .NET Collections - Capacity Pin
Charvak Karpe28-Apr-11 4:47
Charvak Karpe28-Apr-11 4:47 
QuestionHow Can i Create A Class Library For MSACCESS database Connection Pin
Arunkumar.Koloth24-Apr-11 20:03
Arunkumar.Koloth24-Apr-11 20:03 
AnswerRe: How Can i Create A Class Library For MSACCESS database Connection Pin
Tarakeshwar Reddy24-Apr-11 20:13
professionalTarakeshwar Reddy24-Apr-11 20:13 
AnswerRe: How Can i Create A Class Library For MSACCESS database Connection Pin
Richard MacCutchan24-Apr-11 23:02
mveRichard MacCutchan24-Apr-11 23:02 
AnswerRe: How Can i Create A Class Library For MSACCESS database Connection Pin
PIEBALDconsult25-Apr-11 4:01
professionalPIEBALDconsult25-Apr-11 4:01 
AnswerRe: How Can i Create A Class Library For MSACCESS database Connection Pin
ambarishtv28-Apr-11 7:27
ambarishtv28-Apr-11 7:27 
QuestionListBox.PreferredSize.Width interesting event Pin
msn9224-Apr-11 5:33
msn9224-Apr-11 5:33 
Hello

I think I've discovered some kind of bug here:
I have a ListBox control. I fill its content through DataSource property.
First time I set its width equal to ListBox.PreferredSize.Width, no matter what the real preferred width is, it is set to 120.
From the second time use of PreferredSize.Width it works fine: the width is changed according to the content.

class MyCtrl:UserControl
{
    ListBox lb;
    public MyCtrl()
    {
        ...
        lb = new ListBox();
        lb.Visible = false;
        lb.Width = 50; //initially the width is set to 50
        this.Controls.Add(lb);
        ...
    }
    public ShowMyListBox(string[] data)
    {
        lb.DataSource = data;
        lb.Width = lb.PreferredSize.Width; 
        //even though initially the Width is set to 50, lb.PreferredSize.Width returns 120 on the first call
        //but the following calls returns reliable preferred widths.
        lb.Visible = true;
    }
}

Interesting... Is it a bug? Is there any way to fix it?
AnswerRe: ListBox.PreferredSize.Width interesting event Pin
DaveyM6924-Apr-11 13:30
professionalDaveyM6924-Apr-11 13:30 
QuestionArray Pin
messages23-Apr-11 2:40
messages23-Apr-11 2:40 
AnswerRe: Array PinPopular
David198723-Apr-11 3:15
David198723-Apr-11 3:15 
GeneralRe: Array Pin
messages23-Apr-11 3:20
messages23-Apr-11 3:20 
GeneralRe: Array Pin
David198723-Apr-11 4:08
David198723-Apr-11 4:08 
AnswerRe: Array Pin
OriginalGriff23-Apr-11 9:23
mvaOriginalGriff23-Apr-11 9:23 
GeneralRe: Array Pin
Prasanta_Prince23-Apr-11 19:52
Prasanta_Prince23-Apr-11 19:52 
GeneralRe: Array Pin
messages23-Apr-11 20:56
messages23-Apr-11 20:56 
GeneralRe: Array Pin
David198723-Apr-11 21:04
David198723-Apr-11 21:04 
GeneralRe: Array Pin
OriginalGriff23-Apr-11 22:17
mvaOriginalGriff23-Apr-11 22:17 
GeneralRe: Array Pin
messages23-Apr-11 20:54
messages23-Apr-11 20:54 
AnswerRe: Array Pin
Abhinav S25-Apr-11 2:29
Abhinav S25-Apr-11 2:29 
AnswerRe: Array Pin
ambarishtv28-Apr-11 7:36
ambarishtv28-Apr-11 7:36 
QuestionGZipStream ends too early Pin
Paladin200022-Apr-11 11:09
Paladin200022-Apr-11 11:09 
AnswerRe: GZipStream ends too early Pin
Andrew Rissing22-Apr-11 16:55
Andrew Rissing22-Apr-11 16:55 
GeneralRe: GZipStream ends too early Pin
Paladin200025-Apr-11 4:43
Paladin200025-Apr-11 4:43 
GeneralRe: GZipStream ends too early Pin
Andrew Rissing25-Apr-11 5:05
Andrew Rissing25-Apr-11 5:05 

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.