Skip to main content
Filter by
Sorted by
Tagged with
1866 votes
26 answers
2.5m views

I have some code and when it executes, it throws a NullReferenceException, saying: Object reference not set to an instance of an object. What does this mean, and what can I do to fix this error?
948 votes
14 answers
612k views

How do I enable assembly bind failure logging (Fusion) in .NET?
user32736's user avatar
  • 10.5k
505 votes
5 answers
305k views

In Perl (and other languages) a conditional ternary operator can be expressed like this: my $foo = $bar == $buz ? $cat : $dog; Is there a similar operator in VB.NET?
Jim Counts's user avatar
  • 12.8k
476 votes
16 answers
318k views

When is it better to use a List vs a LinkedList?
Jonathan Allen's user avatar
438 votes
47 answers
490k views

How to calculate the difference in months between two dates in C#? Is there is equivalent of VB's DateDiff() method in C#. I need to find difference in months between two dates that are years apart. ...
Rauf's user avatar
  • 12.9k
351 votes
10 answers
520k views

How do I get my C# program to sleep (pause execution) for 50 milliseconds?
TK.'s user avatar
  • 48.1k
328 votes
7 answers
24k views

So I am learning MSIL right now to learn to debug my C# .NET applications. I've always wondered: what is the purpose of the stack? Just to put my question in context: Why is there a transfer from ...
JC JC's user avatar
  • 12.2k
314 votes
14 answers
299k views

Writing a small command line tool, it would be nice to output in different colours. Is this possible?
NibblyPig's user avatar
  • 53.3k
258 votes
8 answers
630k views

I've got a legacy app just starting to misbehave, for whatever reason I'm not sure. It generates a bunch of HTML that gets turned into PDF reports by ActivePDF. The process works like this: Pull an ...
Cᴏʀʏ's user avatar
  • 108k
241 votes
14 answers
418k views

For the following block of code: For I = 0 To listOfStrings.Count - 1 If myString.Contains(lstOfStrings.Item(I)) Then Return True End If Next Return False The output is: Case 1: ...
user57175's user avatar
  • 3,474
226 votes
25 answers
231k views

I have the following code: Using cmd As SqlCommand = Connection.CreateCommand cmd.CommandText = "UPDATE someTable SET Value = @Value" cmd.CommandText &= " WHERE Id = @Id" cmd....
dummy's user avatar
  • 4,324
223 votes
12 answers
174k views

.NET has a lot of complex data structures. Unfortunately, some of them are quite similar and I'm not always sure when to use one and when to use another. Most of my C# and VB books talk about them to ...
Pretzel's user avatar
  • 8,331
219 votes
7 answers
192k views

What types of exceptions should be thrown for invalid or unexpected parameters in .NET? When would I choose one instead of another? Follow-up: Which exception would you use if you have a function ...
Even Mien's user avatar
  • 46.2k
212 votes
17 answers
123k views

What is the best way to get the Max value from a LINQ query that may return no rows? If I just do Dim x = (From y In context.MyTable _ Where y.MyField = value _ Select y.MyCounter)....
gfrizzle's user avatar
  • 12.7k
206 votes
5 answers
202k views

I was wondering if it was possible, in a console application, to write characters like ℃ using .NET. When I try to write this character, the console outputs a question mark.
Sam's user avatar
  • 3,210
202 votes
6 answers
80k views

Is there a VB.NET equivalent for C#'s ?? operator?
Nathan Koop's user avatar
  • 25.3k
194 votes
14 answers
150k views

I want to be able to add a range and get updated for the entire bulk. I also want to be able to cancel the action before it's done (i.e. collection changing besides the 'changed'). Related Q Which ....
Shimmy Weitzhandler's user avatar
182 votes
12 answers
282k views

What is the C# version of VB.NET's InputBox?
wusher's user avatar
  • 12.5k
176 votes
48 answers
205k views

Using VS2012 working on a VB.NET WPF application. I have a simple MusicPlayer tutorial app I am using to learn WPF. I am converting a C# version of the tutorial to VB.NET step by step. It has 2 ...
Jeff Davis's user avatar
  • 1,945
173 votes
8 answers
165k views

Is it considered an acceptable practice to use Modules instead of Classes with Shared member functions in VB.NET? I tend to avoid Modules, because they feel like leftover remains from Visual Basic 6....
Tom Juergens's user avatar
  • 4,612
172 votes
17 answers
166k views

Can you mix vb and c# files in the same project for a class library? Is there some setting that makes it possible? I tried and none of the intellisense works quite right, although the background ...
Wes P's user avatar
  • 9,870
166 votes
12 answers
76k views

Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new StringBuilder(); string cat = "cat"; sb.Append("the ").Append(cat).(" in the hat"); string s = sb.ToString(); would that be ...
lomaxx's user avatar
  • 116k
164 votes
13 answers
92k views

I have a .NET application which has different configuration files for Debug and Release builds. E.g. the debug app.config file points to a development SQL Server which has debugging enabled and the ...
Gavin's user avatar
  • 2,351
162 votes
6 answers
104k views

I'm having some trouble figuring out how to use more than one left outer join using LINQ to SQL. I understand how to use one left outer join. I'm using VB.NET. Below is my SQL syntax. T-SQL ...
Bryan Roth's user avatar
  • 10.8k
157 votes
10 answers
131k views

How to make columns to be auto width when texts in columns are long? I use this code Worksheet.Column(colIndex).AutoFitColumn() 'on all columns' Worksheet.cells.AutoFitColumns() Worksheet.Column(...
Pengan's user avatar
  • 1,833

1
2 3 4 5
2803