vb.net

Form Inheritance in Visual Studios designer implementations

I'm in the process of Moving a project from Visual Studio 2003 to 2005 and have just seen the The event Click is read-only and cannot be changed when using inherited forms regardless of the Modifier on the Base Forms Controls will make all the Controls from the Base Readonly in the designer (Though in 2003 it didn't work this way)...

LINQ Where clause problem

Hi again, When trying to do a query using LINQ in VB.net in order to select some employees of a datatable previously filled with a dataset I have a problem when using where clause. What I want is select all the employees of the datatable except those that appear in a list of excluded employees named CurrentExcludedEmployeesLst. So I fol...

Is it possible to write to the console in colour in .NET?

Writing a small command line tool, it would be nice to output in different colours. Is this possible? ...

Subtract 1 year from datetime

I have seen a lot of info on how to subtract one datetime from the other and how to add years on to a datetime. but the following is giving me a headache.... When a user inserts a record a hidden field called subdate with a value of datetime.now is added to the db. I then need to have an 'old records' page that lists all the entries th...

How do I get my Windows Forms application to use a custom main function and get access to the Application Framework?

Hi Folks I am trying to use a Main () function in a class to control the program flow in my vb .net Windows Forms application. I have added a splash screen component and a login screen, and customised my main sdi form. I have set the startup form to be my main function in the Application Page of the Project Designer, and everything seem...

Windows Service HTTPListener Memory Issue

Hi all, Im a complete novice to the "best practices" etc of writing in any code. I tend to just write it an if it works, why fix it. Well, this way of working is landing me in some hot water. I am writing a simple windows service to server a single webpage. (This service will be incorperated in to another project which monitors the ser...

VB 2008 - Index was outside the bounds of the array

Hey guys I'm having a problem while reading a config.cfg file of my program. I can read the 23. char of the file but I can't read the 24. char (last char in file). This is the code: Dim CFGReader2 As System.IO.StreamReader CFGReader2 = _ My.Computer.FileSystem.OpenTextFileReader(CurDir() & "\Config.cfg") Dim Server(2) As String Server(...

Does a .cs file compile under a .vbproj?

Does a .cs(C#) file compile under a .vbproj(VB.NET project) ? (VS 2005, .NET 2) Say I have Animals.vbproj (namespace Animals) I have Wolf.vb, Tiger.vb, Cat.vb, and a Human.cs Could I use Animals.Human from a external AnimalsForm.vb form? Why? ...

How to take a backup of database of sql server 2005 in VB.net Using Code

Hi I want to know how to take a backup of database using programatically in VB.net of SQL Server 2005. if you are having and idea about it then pls send me the code for that. ...

Error: '<method1>' and '<method2>' cannot overload each other

I override a list in VB. In C# the code compiles and looks like this: class MyObjectCollection : IList { ... /// <summary> /// Gets or sets the element at the specified index. /// </summary> public MyObject this[int index] { get { return (MyObject)innerArray[index]; } set { innerArray[index] = ...

Which new C#/VB features require .net Framework 4?

I remember reading in passing that some of the new language features in C# and VB that are available in VS2010 are backwards compatible with earlier versions of the framework, but that others are not. I'm pretty sure this was in reference to the new property syntax in VB. Which new features are language features vs which ones are frame...

SNMP for Local printer??

Hello, I am searching for a way to Get Information from a local printer. Maybe with the SNMP Protocol? The printer is connected with USB or PPI (parallel port). All printers have a internal TotalPagesCount and support SNMP. Here some examples of the Printers: Brother HL1430 Brother HL5150 Brother HL1230 Kyocera 1118 Kyocera 1128 Kyo...

Neat way of calling InvokeRequired and Invoke

I seem to remember seeing some neat way of calling InvokeRequired and Invoke to avoid repeating too much code in every event handler but I can't remember what that was. So does anyone know a neat way of writing that code? Preferably for VB.Net 2005. ...

Styling VB.net Form With CSS & HTML?

Hello, I am wondering if it is possible to style my VB.net application with CSS and HTML. So far all I can do is apply a windows based theme. Any help would be really appreciated!! ...

Practical example where Tuple can be used in .Net 4.0?

I have seen the Tuple introduced in .Net 4 but I am not able to imagine where can be it be used. We can always make a Custom class or Struct. Edit: I am looking for an example which can also be considered inside the bracket of best practices. ...

GridView does not display correcty sorted Data when i click column

Date column does not display in sorted in GridView using vb.net. In sql server the select query is returning records in sorted manner or in order by. But for some reason GridView does not display properly. it goes to an event preRenderComplete then it binds automatically Protected Sub Page_PreRenderComplete(ByVal sender As Object, ByV...

Why is a .net generic dictionary so big

I am serializing a generic dictionary in VB.net and I am very surprised that it is about 1.3kb with a single item. Am I doing something wrong, or is there something else I should be doing? I have a large number of dictionaries and it is killing me to send them all across the wire. The code I use for serialization is Dim diction...

Enable PostBack for a ASP.NET User Control

When I click my "Query" button, my TestID textbox TestIDTxt retained its value, but both myDatePicker's are blank without any value. Question: How do I preserve StartDate.SelectedDate and EndDate.SelectedDate between postbacks? Solution: As suggested multiple times, removing ReadOnly="true" on the DateTxt kept the text value across pos...

How do I execute some code in a superclass after all the subclasses have been constructed?

Is there a way to do this in C#? I know that the subclass will call the superclass constructor before calling its own constructor, but what If I have some code on the superclass that should only be executed after all the subclasses constructors have been called? ...

itunes sdk list albums

Hi guys, I'm working on a new test app (just out of curiosity really) which is an add on to iTunes. I'm trying fairly basic things at the mo, and have managed to control volume, pause etc etc. I have a function from some demo code which loops through all the tracks in my main library and gets their album name... I then show the indivi...