vb.net

Most optimized/effective way to convert a collection into an array?

I know it must have been asked more than twice, but I could not find any applicable question to answer the matter. I have a collection which I wish to retrieve an array from in .NET 2.0. In other words, I want to convert a collection into an array. So far I have the following: Public Class Set(Of T) Implements IEnumerable(Of T) ...

How to ensure a Windows Form is "fully" closed?

I have a form in a Windows form application that I want to display on top of a main form, close it, and then immediately show a dialog box using MessageBox.Show(). But the first form is still showing when the message box is shown, and it does not disappear until I click OK on the message box. I tried waiting to show the message box in ...

Get Request.Form.Item by matching Request.Form.Key

My Request.Form keys are all prefixed with ctl00$container name$ and then the key I want. How can I get the regular key name working? Visual example from the immediate window: I want to use: ? request.Form.Item("stationIdea") but it won't work because the key is: ctl00$content_innovation_body$stationIdea as retrieved by ? reque...

Event Handling an Abstract Class

Basically, I have a custom child form class which has events that will be passed to the parent. In the custom child form, I have a declaration of a "MustInherit" class that inherits the DevExpress User Control Class. The reason for this, is I have many user controls that derive from this base class, and the child form can have an instan...

how to keep the rows ordering of datatable unchanged?

I have the following datatable with the ordering of DataClassIndex column before editting: DataclassIndex 0 1 2 3 4 When I start modifying some other cells in this datatable, the ordering of DataClassIndex column changes to something like this DataclassIndex 3 4 2 1 0 How can I modify a datatable content without altering the original...

Linq to objects

I have 2 databases from different servers. I cannot link the databases. The data is retrieved from the databases as : DB1 - Client_ID Engagement_ID Enabled Description 600 10 True Company1 600 20 False Company2 700 10 True Company3 DB2 Client_ID Engagement_ID Enabled Description 600 5 True Company1 600 10 False Company2 500 30 T...

How to build 64-bit Visual Basic.NET in Visual Studio 2010?

Hopefully this is a simple question and I have just overlooked something somewhere... I am writing VB.NET stuff in VS2010 on Windows 7 64-bit. It seems to build by default for a 32-bit target, how to I tell it to make a 64-bit executable? I went to the project properties -> Compiler -> Advanced, but don't see the option anywhere. Oh, ...

Property Grid Color Picker control not allowing custom color editing

When using the Property Grid and exposing a color property from an object you get this kind of interface for color selection: There are tabs for System and Web, those are fine, but the Custom tab (shown) which seems to be a subset of the standard windows color picker, seems to be hobbled. How do you create custom colors? How do you ge...

Develop in C# but deliver in VB.NET

We are an team that are dedicated C#, and will start with an new project, there the customer really wants it in VB.NET. Are there a bad choice to do the development in C# and then convert it and deliver in VB.NET. Are there any tools that will make this easier to us than any simple converter? ...

List AD Groups with Access to a File or Directory in VB.Net

I'm writing code to parse through a list of file directories and identify which AD groups have access. That info is available in the operating system under the file properties security tab, but I can't find any code examples that retrieve that info in vb.net (or c#). Anyone have code that will do that? ...

Find If User is Member of Active Directory Group ASP.NET VB?

I am using Active Directory to authenticate users for an intranet site. I would like to refine the users that are authenticated based on the group they are in in Active Directory. Can someone show me or point me to directions on how to find what groups a user is in in ASP.NET 4.0 (VB)? ...

ASP.NET/VB Iterate Through Collection, Do..This on Result Found, Do..That on Result Not Found.

[This is a simplified example] I have a collection ("myCollection") in which exists three entries: ("hello", "goodbye", "welcome"). I want to iterate through the collection and if in the collection there is the entry "welcome" I want to take one action, if that entry doesn't exist I want to do something else. Like this (pseudo): For Ea...

Sending Multiple Words to Another Program

How would I output a sentence with VB.NET? Example: Your program and Internet Explorer are open, your program outputs "http://stackoverflow.com" and presses "{ENTER}", and it will go to the page. Example: An auto-talking bot for MSN. ...

how to save/restore a form and controls between program runs?

I have a complex form to allow the user to configure my app. What's the best way to save the form state & reload when the program next runs. I mean text he has entered in list boxes, the selected item of combo/list/radio, whether a checkbox is cheeked, etc ...

ASP.NET MVC2 lowercase Routes in Visual Basic

I have found 4 or 5 examples of "lowercase routes" in C# however when I use the telerik code converter, I get a bunch of errors. Namely something to do with "extension methods can be defined only in modules." Does anyone have any good resources on how to map routes to lowercase in VB? EDIT: here is an example of some converted code t...

Using LINQ to SQL to search entire database

Is it possible with LINQ to SQL to search the entire database (obviously only the parts that are mapped in the .dbml file) for a string match? I'm trying to write a function that will take a string of "Search Term" and search all mapped entities and return a List(Of Object) that can contain a mixture of entities i.e. if I have a table "F...

How to check Day & month from date which is in Database table

Hi I have problem here... I want to check Day & month of date which is in database. There is date field is in database which is mm/dd/yyyy format If I use "select" query then whole Date is access but I want only these date's which having today's day & month Example: if today's date is 02/02/2010 then select only those date whose day i...

Event that fires only when user moves the splitter?

I have a VB .NET form with a splitter control on it, and I want to save its position between program runs. I am currently handling the SplitterMoved event and storing the SplitterDistance. Then on program startup, I set the SplitterDistance to the saved value. However, sometimes the program resizes the splitter, raising the SplitterMo...

Filter Custom Dictionary with LINQ ToDictionary - "Unable to cast object of type 'System.Collections.Generic.Dictionary`2"

I have created a Dictionary class (MyDictionary for the example). I am currently trying to pass MyDictionary into a function, filter it into a new instance of MyDictionary and pass this new instance into another method. When I am attempting to create the second instance from the filtered first instance of MyDictionary via Lambda Expres...

ItemDataBound 'e.item.dataitem("key")' with ListView Control

With the ASP.NET Repeater control, I am used to being able to access my data item values in the ItemDataBound Event Handler by doing: e.item.dataitem("column_name") However, it seems with the ListView control this is not possible. How can I access the data item values? ...