vb.net

Invalid page requested during lifecycle of another page request (in IE and NOT in Firefox)

Bear with me on this one! Right. Clicking on a link button on a page causes Postback to a page containing a number of controls. For arguments sake say page a.aspx containing a link button containing user controls control b.ascx control c.ascx When clicked page d.aspx is requested. During the Postback to (page a) on the...

Why does the compiler think this is an Object instead of a DataRow?

I'm using a LINQ query to translate data inside a DataTable object to be a simple IEnumerable of a custom POCO object. My LINQ query is: Dim dtMessages As DataTable '...dtMessages is instantiated ByRef in a helper data access routine... ' Dim qry = From dr As DataRow In dtMessages.Rows Select New OutboxMsg...

reference to c++ dll

Hey, I was add to my program reference to dll and it's work good. Declare Function adc11_get_driver_version Lib "C:\example.dll" () As Integer but I want to write the specific location of the dll from file(config file) and replace the "C:\example.dll" by string how can I do this? thanks Saar ...

While in edit mode, advance to next cell and stay in edit mode for VB.NET DataGridView?

I have a DataGridView in which one column has data that the user needs to align by adding spaces. For example, the first two rows might contain: kumbu kuimbiu And the user needs to be able to line up the letters that match by adding spaces. Something like this: ku mb u kuimbiu Now in order to do that with the DataGridView, the us...

VB2010 - For Loop Exiting Issue

I have a simple for loop with the following code For i As Integer = 0 To 4 Snake(i).X = (120 - 20 * i) Snake(i).Y = 120 SnakeBody(i).Location = New Point(Snake(i).X, Snake(i).Y) Snake(i).Facing = 3 Next i But for some reason I unable to debug it. I place a breakpoint on the line...

Custom Listview Column Sort Image to Right

I support a .Net 2.0 Windows application that has a custom listview control to allow for greater flexibility. I am not allowed to bring this to a newer version of the gramework until next year. We are moving from XP to Windows 7, and we have identified an issue with how the column sort image (up/down arrow) is drawn to the listview. C...

Get Font Width within VB.net Without Measuring a Control?

I need to display a table in rich text within a form window. It is only a two column table, so tabbing works fine to line everything up (since RichTextBox does not support RTF tables). However, sometimes the tab stops are incorrect because of non-fixed width fonts. So, I need a way to measure the pixel width of a particular string with...

Sort Datatable/Dataview/Gridview of files based on File Modified Date

I have a page which lists all the files in a particular folder (all PDFs), using a data-table and gridview. I'm currently sorting this table by the filename (by using a dataview), which isn't that helpful, and I want the gridview of files sorted by the file created or file modified date (as recorded in Windows). If that's not possible,...

Is there a way to change the order of constructors listed in IntelliSense in Visual Studio?

I have defined a class with multiple constructors so that the underlying interfaces are immutable once the object is instantiated. I would like one of the constructors to be the "default" constructor for when a user types the following in Visual Studio: var obj = new MyClass( Dim obj As New MyClass( Currently when I go to instantiat...

placing a shortcut in user's Startup folder to start with Windows

I wanted to give my user an option for "Start with Windows". When user check this option it will place a shortcut icon into Startup folder (not in registry). On Windows restart, it will load my app automatically. How can this be done? ...

Loading swf files from memorystream

I have an .swf (e.g. shell.swf) that is being streamed to axShockwaveFlash, but this movie get data from another .swf file (let's say data.swf). I load shell.swf from memorystream with no problem, but it can't load or reference data.swf. Any suggestions? Thanks a lot. ...

Server halts due to large StringBuilder instance in memory

So, I have this code that grabs a bunch of data from the database, and performs a bunch of calculations on that data. However, this is not what is causing the halt. The halt is coming in when I take all that "final" data that has been prepared, and go to write that into a text file. Each line in the text file is being created from data ...

Regular expression for extracting a number

I would like to be able to extract a number from within a string formatted as follows: "<[1085674730]> hello foo1, how are you doing?" I'm a novice with regular expressions, I only want to be able to extract a number that is enclosed in the greater/less-than and bracket symbols, but I'm not sure how to go about it. I have to match num...

WMI and getting CommandLine of running Process in VB.net

This is the command line I want to use inside my VB.NET program. Look for the running process "mpc-hc.exe" and get the commandline of the running process wmic process where name='mpc-hc.exe' get CommandLine I want to retrieve the output from that command into a string. I know that it could be done natively in a VB.NET program and I ha...

VB.NET - Custom Serialization and Circular References, is there a clean solution?

I'm implementing some custom serialization (to byte array), and have run into a problem handling circular references. Example: Class A public MyBs as new List(of B) end class class B public MyParent as A public MiscInt1 as integer public MiscInt2 as integer end class When serializing A, I must serialize each instance of B....

How is hash implemented in .NET?

Possible Duplicate: How does Object.GetHashCode work when the GC moves an object? The garbage collector in .NET moves objects, so the object's address is not stable. How is Object's GetHashCode() method implemented? Thanks! ...

How to avoid if... else and switch cases

Hi guys, I have been programming for alot of time. Generally i program in some languages like PHP, ASP.net, Java, JavaScript and others. In all languages i have to use alot of if else statments . Like if value= 10 then ... if i review my code then i find alot of if conditions. So i would like to minimise them but how not sure. one poi...

Installing Windows services gives an error

Hi, I created a simple windows service on my local PC and added the following code to it Protected Overrides Sub OnStart(ByVal args() As String) Const iTIME_INTERVAL As Integer = 60000 ' 60 seconds. Dim oTimer As System.Threading.Timer System.IO.File.AppendAllText("C:\AuthorLog.txt", _ "AuthorLogService has...

LINQ .Startswith or .Contains problems in VB.NET4

Hi! This may be a newbie question... In my code I can easily use "where Obj.Feld = String", but using "where Obj.Feld.StartsWith("a")" doesn't work. See the following two functions: Public Function EntriesByFileName(ByRef Database() As Entry, ByVal Filename As _ String) As IEnumerable(Of Entry) Dim Result As IEnumerable...

Help Converting code to VB.net

I got this code from msdn http://code.msdn.microsoft.com/eventbehaviourfactor I have most of it converted but having an issue with the following sub getting it converted correctly Protected Overrides Sub AdjustEventHandlers(ByVal sender As DependencyObject, ByVal oldValue As Object, ByVal newValue As Object) Dim elemen...