Click here to Skip to main content
15,920,687 members
Home / Discussions / C#
   

C#

 
Questionaccess data in dataset dependent on selected combobox value Pin
CandyMe6-Nov-05 0:14
CandyMe6-Nov-05 0:14 
QuestionDatagrid Binding to an Object Pin
wgroves5-Nov-05 20:13
wgroves5-Nov-05 20:13 
AnswerRe: Datagrid Binding to an Object Pin
J4amieC6-Nov-05 0:31
J4amieC6-Nov-05 0:31 
GeneralRe: Datagrid Binding to an Object Pin
wgroves6-Nov-05 10:13
wgroves6-Nov-05 10:13 
AnswerRe: Datagrid Binding to an Object Pin
n10sive10-Nov-05 12:15
n10sive10-Nov-05 12:15 
QuestionZooming in/out of Pictures in a PictureBox Control Pin
E6AD5-Nov-05 19:57
E6AD5-Nov-05 19:57 
AnswerRe: Zooming in/out of Pictures in a PictureBox Control Pin
Jon Rista8-Nov-05 7:21
Jon Rista8-Nov-05 7:21 
QuestionReseting Object Arrays With New Length Pin
budidharma5-Nov-05 17:11
budidharma5-Nov-05 17:11 
Here's an example of what I'm dealing with:

int[] myints = new int { 1, 2, 3 };

foreach(int i in myints)
{
Console.Write(i.ToString()); // WORKS PERFECT.
}
Console.Write(myints.Length); // Displays 3.


int[] newints = new int { 1, 2, 3, 4 };
myints = newints;

foreach(int i in myints)
{
Console.Write(i.ToString()); // WORKS PERFECT.
}
Console.Write(myints.Length); // Displays 4

int[] reallynewints = new int { 1, 2 };
myints = reallynewints;
foreach(int i in myints)
{
Console.Write(i.ToString()); // THROWS NULLEXCEPTIONERROR
}
Console.Write(myints.Length); // Displays 2

So, here's the problem I'm having. When you set an array equal to an array with less elements, the Length property is updated, but there is still a null reference inside the array to an unused array element. You can fix the problem by overloading the Int.ToString() method with a try-catch block to avoid the error, but that's just a patch. How can I reset the array completely, so there is not a null reference to unused elements?
AnswerRe: Reseting Object Arrays With New Length Pin
leppie5-Nov-05 18:53
leppie5-Nov-05 18:53 
GeneralRe: Reseting Object Arrays With New Length Pin
budidharma5-Nov-05 19:09
budidharma5-Nov-05 19:09 
AnswerRe: Reseting Object Arrays With New Length Pin
S. Senthil Kumar6-Nov-05 19:57
S. Senthil Kumar6-Nov-05 19:57 
QuestionRe: Reseting Object Arrays With New Length Pin
Jon Rista8-Nov-05 7:19
Jon Rista8-Nov-05 7:19 
Questionget serial number of cd in c# ? Pin
hdv2125-Nov-05 13:53
hdv2125-Nov-05 13:53 
Questioncontext menu on service notifyicon Pin
g00fyman5-Nov-05 13:09
g00fyman5-Nov-05 13:09 
QuestionOverloading Index Operator Pin
budidharma5-Nov-05 12:05
budidharma5-Nov-05 12:05 
AnswerRe: Overloading Index Operator Pin
Heath Stewart5-Nov-05 12:39
protectorHeath Stewart5-Nov-05 12:39 
QuestiondataGrid - change background color of cell on RUN TIME Pin
dataminers5-Nov-05 11:22
dataminers5-Nov-05 11:22 
AnswerRe: dataGrid - change background color of cell on RUN TIME Pin
Heath Stewart5-Nov-05 12:42
protectorHeath Stewart5-Nov-05 12:42 
GeneralRe: dataGrid - change background color of cell on RUN TIME Pin
dataminers5-Nov-05 12:50
dataminers5-Nov-05 12:50 
GeneralRe: dataGrid - change background color of cell on RUN TIME Pin
Heath Stewart5-Nov-05 12:53
protectorHeath Stewart5-Nov-05 12:53 
GeneralRe: dataGrid - change background color of cell on RUN TIME Pin
dataminers5-Nov-05 13:03
dataminers5-Nov-05 13:03 
GeneralRe: dataGrid - change background color of cell on RUN TIME Pin
Heath Stewart5-Nov-05 13:42
protectorHeath Stewart5-Nov-05 13:42 
QuestionLDAP User management Pin
WillemM5-Nov-05 9:18
WillemM5-Nov-05 9:18 
QuestionC# and .NET Framework Pin
Yevgeny Efter5-Nov-05 9:11
Yevgeny Efter5-Nov-05 9:11 
AnswerRe: C# and .NET Framework Pin
André Ziegler5-Nov-05 9:13
André Ziegler5-Nov-05 9:13 

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.