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?
103 votes
6 answers
113k views

I've heard that "everyone" is using parameterized SQL queries to protect against SQL injection attacks without having to vailidate every piece of user input. How do you do this? Do you get this ...
Jim Counts's user avatar
  • 12.8k
58 votes
3 answers
55k views

I saw this post: Typos… Just use option strict and explicit please.. during one software development project, which I was on as a consultant, they were getting ridiculous amounts of errors ...
yretuta's user avatar
  • 8,141
140 votes
28 answers
248k views

I need to get all controls on a form that are of type x. I'm pretty sure I saw that code once in the past that used something like this: dim ctrls() as Control ctrls = Me.Controls(GetType(TextBox)) I ...
Luis's user avatar
  • 1,880
426 votes
26 answers
119k views

I like instantiating my WCF service clients within a using block as it's pretty much the standard way to use resources that implement IDisposable: using (var client = new SomeWCFServiceClient()) { ...
Eric King's user avatar
  • 11.8k
110 votes
15 answers
331k views

I have a large(ish) form in MVC. I need to be able to generate an excel file containing data from a subset of that form. The tricky bit is that this shouldn't affect the rest of the form and so I ...
Valuk's user avatar
  • 1,636
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
235 votes
8 answers
416k views

I have found several open-source/freeware programs that allow you to convert .doc files to .pdf files, but they're all of the application/printer driver variety, with no SDK attached. I have found ...
Shaul Behr's user avatar
  • 38.2k
488 votes
20 answers
217k views

Inspired by another question asking about the missing Zip function: Why is there no ForEach extension method on the IEnumerable interface? Or anywhere? The only class that gets a ForEach method is ...
Cameron MacFarland's user avatar
197 votes
16 answers
120k views

Should you set all the objects to null (Nothing in VB.NET) once you have finished with them? I understand that in .NET it is essential to dispose of any instances of objects that implement the ...
John's user avatar
  • 30.7k
476 votes
16 answers
318k views

When is it better to use a List vs a LinkedList?
Jonathan Allen's user avatar
18 votes
11 answers
63k views

I have a small problem that I can't seem to figure out. I am saving a DataGridView (it's contents) to an xls file. I have no problem in doing so except in my task manager its still showing up that it'...
Trevor's user avatar
  • 8,015
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
0 votes
2 answers
1k views

I have 3 Forms namely MainForm, Form1 and Form2. MainForm hosts Form1 in a Panel. On Clicking a button in MainForm, I am opening Form2 using ShowDialog() method. Now I have a treeview in Form2. Now I ...
coding_cs's user avatar
120 votes
20 answers
428k views

When I try to create a instance of a COM class it throws an exception as Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) Please suggest how could i solve it?
Jaswant Agarwal's user avatar
56 votes
3 answers
17k views

I was just writing some quick code and noticed this complier error Using the iteration variable in a lambda expression may have unexpected results. Instead, create a local variable within the ...
Nathan W's user avatar
  • 55.7k
59 votes
2 answers
37k views

I have a view model with a property that exposes a collection of things. I have a ComboBox whose ItemsSource property is bound to this collection. Now the user can select from the list. I want to ...
Frinavale's user avatar
  • 3,970
2 votes
2 answers
13k views

I made a file search program in visual studio on windows 10 using .net lang, My problem starts from form1 with a "dim frm2 as form2 = new form2" call, after the new form being shown i start a while ...
burgil's user avatar
  • 395
82 votes
8 answers
69k views

Is there an equivalent for the C# 4 'dynamic' keyword when using type safe VB.NET, i.e. with Option Strict On?
jeroenh's user avatar
  • 26.9k
176 votes
8 answers
166k views

I have a class. Public Class Foo Private _Name As String Public Property Name() As String Get Return _Name End Get Set(ByVal value As String) ...
Sachin Chavan's user avatar
150 votes
11 answers
133k views

I've read that it's unwise to use ToUpper and ToLower to perform case-insensitive string comparisons, but I see no alternative when it comes to LINQ-to-SQL. The ignoreCase and CompareOptions arguments ...
BlueMonkMN's user avatar
  • 25.7k
77 votes
24 answers
49k views

We are rewriting our legacy accounting system in VB.NET and SQL Server. We brought in a new team of .NET/ SQL Programmers to do the rewrite. Most of the system is already completed with the dollar ...
Gerhard Weiss's user avatar
93 votes
9 answers
96k views

I need a way to have this: "test, and test but not testing. But yes to test".Replace("test", "text") return this: "text, and text but not testing. But yes to text" Basically I want to replace ...
Vaccano's user avatar
  • 83.2k
45 votes
12 answers
308k views

I'm hoping someone here can point me in the right direction - I'm trying to create a fairly robust utility program to read the data from an Excel sheet (may be .xls OR .xlsx) into a DataTable as ...
John Bustos's user avatar
  • 19.7k
182 votes
12 answers
282k views

What is the C# version of VB.NET's InputBox?
wusher's user avatar
  • 12.5k

1
2 3 4 5
216