.net

Autocomplete AND preventing new input - combobox

How can I allow the users of my program to type in a value and have it auto-complete, however, I also what to prevent them from entering new data because it would cause the data to be unfindable (unless you had direct access to the database). Does anyone know how to do this? The reasoning behind not using just a dropdown style combobox...

Word 2007 Master Pages

I'm using the Open XML SDK to work with Word 2007 templates, and the project continues to progress nicely. Now I would like to add consistent headers and footers to every document, very similar to an ASP.NET MasterPage. In particular, I'd like to compose a template document with a content document, then fill the content using the approac...

Garbage collection in yield Methods

Say I have a method like this (stolen from a previous SO answer by Jon Skeet): public static IEnumerable<TSource> DuplicatesBy<TSource, TKey> (this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) { HashSet<TKey> seenKeys = new HashSet<TKey>(); foreach (TSource element in source) { // Yield it if the...

ToString() does not return the expected string

using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication3Generics { class Program { static void Main(string[] args) { ScheduleSelectedItems sitems = new ScheduleSelectedItems("Yusuf"); ScheduleSelectedItemsList slist = new ScheduleSelectedItemsList()...

What are the advantages/disadvantages of Generic List (Of Type) and Collections

As the questions says I have always believed that a strongly typed list is a better appraoch that using collections. However after discussions with a colleague today I was wanting to have a better answer than "because I like them" Can anyone explain a) the major differences and the benefits/disadvantages of each approach. Edit: Similar ...

Getting assemblies to show in the .NET tab of Add Reference

When working with Visual Studio and adding a reference to a project you are presented a window with multiple tabs; .NET, Project, Recent, and Browse. What is needed to get an item listed under the .NET listing? We have items in the GAC which we thought would get them listed there, but they are not. We are looking for methods to be a...

Html.DropDownList no longer works after upgrade to ASP.NET MVC RC1

I had the following piece of code in a web app running on ASP.NET MVC Beta: <%= Html.DropDownList("Instances", new { style="width:270px;", onchange = "UpdateReport(this)" }) %> where "Instances" is a SelectList stored in ViewData, like so: ViewData["Instances"] = new SelectList(instanceList, "Id", "ClientName", report.SelectedId); ...

Need help in login redirect using asp.net

Hello all, I have problem with Login page.If i dont enter the Username or password it should say that"please enter a Username or password" instead its going to destination page i mean without entering anything in Login field if i hit submit button its going to welcome page actually which should not happen. Here is my code please somebod...

Returning XML natively in a .NET (C#) webservice?

I realize that SOAP webservices in .NET return XML representation of whatever object the web method returns, but if I want to return data formatting in XML what is the best object to store it in? I am using the answer to this question to write my XML, here is the code: XmlWriter writer = XmlWriter.Create(pathToOutput); writer.WriteStar...

Checking whether the current thread owns a lock

Suppose I have the following code: public class SomeClass() { private readonly object _lock = new object(); public void SomeMethodA() { lock (_lock) { SomeHelperMethod(); //do something that requires lock on _lock } } public void SomeMethodB() { lock (_lock) { SomeHel...

Is there a better option than DataGridView for repeating WinForms data?

I'm facing the need to enter "ragged" data in a WinForms application. Some columns are required for some types of entry lines and are not permitted on other entry lines, and the combo box data in later columns needs to vary based on the earlier columns. My question is: is there a better way to handle data that isn't quite as regular as ...

Error opening serial port

I'm trying to open and read from a serial port using the System.IO.Ports.SerialPort class. I dragged the serial port from the tool pane (VS 2008) on to my windows form. I've got a property grid set up so I can easily change properties of the serial port at runtime. When I try to open the port, I get the error shown below. I don't under...

How to configure multiple modules using .net configuration files

I have a few .net modules/libraries I am referencing from my main application. Each of the modules/libraries can be configured and after I build them they each have a configuration file such as MyModule1.dll.config, MyModule2.dll.config. When I build my main application an app.config file is outputted to the output directory. I am wond...

XmlSerialization Collection as Array

I'm trying to serialize a custom class that needs to use multiple elements of the same name. I've tried using xmlarray, but it wraps them in another elements. I want my xml to look like this. <root> <trees>some text</trees> <trees>some more text</trees> </root> My code: [Serializable(), XmlRoot("root")] public class test...

How do I get the available wifi APs and their signal strength in .net?

Is there any way to access all WiFi access points and their respective RSSI values using .NET? It would be really nice if I could do it without using unmanaged code or even better if it worked in mono as well as .NET. If it is possible i would appriciate a code sample. Thanks Here are a few similiar stackoverflow questions i found: ...

Disinheriting(?) / overriding .ToString to access COM Object .toString

I have a java library that I am accessing in VB.NET via COM. The objects on the java side expose non-trivial .toString methods that I need for debugging. Unfortunately, when I call .toString on the COM objects, the call is being intercepted by the Object class' .ToString function. How do I force the call to the COM-side .toString and ...

Survey Web Application

Hi, I was just wondering if anyone knew of any (preferably open source, or cost) web controls for survey management, that can be used in the .NET environment. Any recommendations are greatly appreciated, thanks. ...

If a generic collection is instantiated to contain iDisposable items, do the items get disposed?

For example: Queue<System.Drawing.SolidBrush> brushQ = new Queue<System.Drawing.SolidBrush>(); ... brushQ.Clear(); If I don't explicitly dequeue each item and dispose of them individually, do the remaining items get disposed when calling Clear()? How about when the queue is garbage collected? Assuming the answer is "no", then what is...

LINQBridge users: is it feature-complete?

For desktop programmers, do you avoid deploying .NET 3.5 framework on client machines for its big footprint? If so, is LINQBridge feature-complete? [EDIT] .NET 3.5 Framework evokes a feeling of OLE 2.0 (aka COM). When 2.0 newly came out, some users then are asking if there will be OLE version 3.0. But there will be none. OLE 2.0 is...

What's the equivalent of PostMessage to self, for Windows Forms?

I'm writing a custom control derived from System.Windows.Forms.Control. The control is using the Control.KeyDown event, to watch keystrokes: I should handle some keystrokes (for example <Ctrl>-K) as hotkeys, which cause me to launch a dialog box. If I launch the dialog from my onKeyDown event handler, the dialog is displayed before I s...