vb.net

Or versus OrElse

Whats the difference between or and OrElse? if temp is dbnull.value or temp = 0 produces the error *Operator '=' is not defined for type 'DBNull' and type 'Integer'.** while this one works like a charm! if temp is dbnull.value OrElse temp = 0 ...

VB.net Marshalling Error

Hi, I have to create an array of structure type in VB.net. but I am getting error while marshalling this error. I have to pass this array of structure type in to Dll function. Code: Structure declaration: <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _ Public Structure dx_entry <MarshalAs(UnmanagedType.ByValT...

vb.net VS2005 IDE hangs on Vista Home Premium

I've bought a new Vista Home Premium Toshiba laptop. Loaded Visual Studio 2005 Pro, then SP1, then the vista patch. Thus my versions are as follows: Microsoft Visual Studio 2005 Version 8.0.50727.867 (vsvista.050727-8600) Microsoft .NET Framework Version 2.0.50727 SP2 Open an existing or new solution / projects. Then go to type some c...

Assign a type to an object at runtime in vb.net or c#

I have an object, o, and a type, T. I'd like to use reflection to change object o to type T at runtime without instantiating it. The equivalent at compile time would be: Dim p as Point = Nothing I know how to use Activator.CreateInstance to create an instance at run time that is equivalent to: Dim p as New Point() But i don't want...

Passing a constant array to a function in VB .NET

Hello everybody, I know that you can easily pass an array to a function, like the code below shows Private Sub SomeFunction(ByVal PassedArray() As String) For i As Integer = 0 To PassedArray.Count - 1 Debug.WriteLine(PassedArray(i)) Next End Sub Public Sub Test() Dim MyArray As String() = {"some", "array", "members...

Convert String to Double - VB

Is there an efficient method in VB to check if a string can be converted to a double? I'm currently doing this by trying to convert the string to a double and then seeing if it throws an exception. But this seems to be slowing down my application. Try ' if number then format it. current = CDbl(x) current = Math.Round(curren...

How do I expose built-in security and user management to a MVC application?

I have built a MVC website on IIS6. I used the built-in ASP.NET Security without Membership, just the way it was implemented in the template solution. It is easy to secure a contoller or action, but now I need to expose the user management to an admin logged into the site. I understand that the builtin ASP controls for doing this are n...

Performance counters incrementing improperly?

Probably a rookie error, but i'm getting something strange. i'm trying to weave a .NET performance counter into an application. When i call the incrementBy(value) method on my avg performance counter it is changing the RawValue of my base counter by value as well. i checked the variable names and think everything is correct. Then when...

FileUpload asp.net

I want to force my user to only search in a particular folder when using the fileupload control. Is that possible? ...

"Overloads" keyword in VB.NET

Do you really need this keyword to overload methods? What is the difference between using the overloads keyword vs. just having different method signatures? ...

vb 2008 Run Grayed Out-on

My Run button is grayed out. This includes starting a new project of any type. I completely un-installed VS 2008 and Re-Installed it. The Run is Still grayed out. VB is now worthless. ...

searching a list object

I have a list: Dim list As New List(Of String) with the following items: 290-7-11 1255-7-12 222-7-11 290-7-13 What's an easy and fast way to search if duplicate of "first block" plus "-" plus "second block" is already in the list. Example the item 290-7 appears twice, 290-7-11 and 290-7-13. I am using .net 2.0 ...

What do you call a looping progress bar?

Ok I'm just at a loss for what the correct terminology is for this. I'm looking for the correct name to call a progress bar that "loops". Instead of the standard progress bar that fills up from left to right to 100%, this looks exactly like the progress bar but a small portion of the fill color constantly loops, never filling the whole...

Pull one record from the database and bind to an HTML tag

In ASP.NET, what is the definitive way to pull one record from the database and bind it and HTML tag? Brevity and style points count. ...

LINQ to SQL delete producing "Specified cast is not valid" error

I've got a painfully simple table that is giving me a "Specified cast is not valid" error when I try to delete one or more rows. The table has two columns, an "id" as the primary key (INT), and a "name" (VARCHAR(20)), which maps to a String in the LINQ to SQL dbml file. Both of these statements produce the error: dc.DeleteOnSubmit(dc.My...

Convert VB to C# - My.Application.Info.DirectoryPath

What are the best C# (csharp) equivalents for the following VB (VB.NET, VisualBasic) statements: My.Application.Info.DirectoryPath My.Computer.Clipboard My.Computer.Audio.PlaySystemSound() My.Application.Shutdown() ...

What's the C# equivalent to the With statement in VB?

Possible Duplicate: Equivalence of WithEnd With in c#? There was one feature of VB that I really like...the With statement. Does C# have any equivalent to it? I know you can use using to not have to type a namespace, but it is limited to just that. In VB you could do this: With Stuff.Elements.Foo .Name = "Bob Dylan" .Ag...

Transactionscope not working on SQLite in Subsonic

I have trouble using the transactionscope on SQLite, i am using the following code. Changes are still commited to the database while i don't call the ts.Complete() function. Using ts As New System.Transactions.TransactionScope() Using sharedConnectionScope As New SubSonic.SharedDbConnectionScope() ' Do your individual saves here' ...

How can I find the Harddisk Device Serial Number without using the WMI in .NET?

I want to get the hardwired serial number from the hard disk but NOT using WMI. I tried using WMI code, and it doesn't work on my machine for sure. So is there any alternative in .NET for finding the Serial Number of a physical hard disk? ...

Crawler in C# or in VB.net

Hi, can anyone help me to have a link of working crawler sample code written in either c# or in Vb.net thanks ...