vb.net

Error accesing SQLite file

I used http://sqliteadmin.orbmu2k.de/ to create my sqlite db file. I created it as a sqlite db version 3 file. When I go to open the connection Dim Connection As New SQLite.SQLiteConnection(DATABASE_FILE_LOCATION) Connection.Open() I am getting this exception on the Open() call "File opened that is not a database file file is enc...

List all virtual directories in IIS 5,6 and 7

I am trying to create a list of all virtual directories within an IIS site. However, I have found that trying to do this varies dramatically in the older versions of IIS. In IIS 7 this is a relatively easy task via C# but I can't seem to find a good method for doing this in IIS 6 and 5. I have tried using the System.DirectoryService...

Any way to clear all WithEvents fields via one command?

The vb.net "WithEvents" syntax is very useful, but if a WithEvents field which references a long-lived object is not nulled out, it will often constitute a memory leak. Is there any easy way for a Dispose routine to have vb.net automatically clear out all WithEvents fields and unsubscribe them? I've figured out a nice way to wrap the c...

VB: get compiled DLL's calling application info; COM security

Through COM, one can potentially gain absolute control over a target system. For example: using javascript's ActiveXObject object in IE, one can create certain objects which were designed to have direct access or interaction with system properties and files. One would think common sense dictates users disable ActiveX features in IE imm...

Public Properties within VB Module - Cross-client Behavior

Can one client call a public property within a VB.NET module and see the value of that public property changed by another client accessing it at the same time? Example: Client 1 calls Public Module DataModule Private theDateTime As DateTime = GetAdjustedDateTime() //initial TZ value Public Property GetSetDateTime() As DateTim...

how to convert vb6 to vb.net programmatically

Visual Studio comes with Wizard that converts vb6 code to vb.net. Is there are any way to call this conversion via code? ...

Is this String.Compare CodeRush suggestion one that I should take?

Dim rowChinaVisa As DataRow CodeRush is suggesting that I change this line If rowChinaVisa("sex").ToString = "M" Then to: If String.Compare(rowChinaVisa("sex").ToString, "M", False) = 0 Then I prefer how the orig line reads, but I am wondering if the recommended line is more efficient. Perhaps for LONG strings only? ...

compiling VB6 code in .NET environment

Is one able to compile VB 6 code in Visual Studio.NET ? In other words, is it backwards compatible with older VB code? Since I know there is a difference between managed code (.NET) and unmanaged code, I am wondering if Visual Studio.NET is able to compile unmanaged code as well? Kind regards, Kris ...

Allow to save data on access db using vb or c# on win7 or vista?

Hi all, I want to install my app or (just access db)to AppData folder to enable write for it. so, how can I do that in setup project. Is there just parameter or should I wirte custom action. Thx. ...

Convert SqlCommand to T-SQL command

I have an SqlCommand with parameters. Due to some external requirement (see PS), I need one T-SQL string instead, i.e., I need ... @parameter ... replaced by ... the-value-of-@parameter-encoded-correctly ... (e.g. O'Brien --> 'O''Brien', 02 Mar 2010 --> '20100302', 3.5 --> 3.5). I know that I could home-brew such a solution quite easil...

Is it possible to have forms in sub-namespaces of a VB.NET WinForms project?

If I create a new class library project in VB.NET, I can create subfolders (a la C#), add WinForm objects to these subfolders, and then specify a namespace: Namespace Sub1.Sub2 Public Class SomeForm Public Sub New() InitializeComponent() End Sub End Class End Namespace This resolves as ProjectRootN...

What will be the output for the following – f1("enritcde3 dtyeds4t8", 2)

Function f(ByVal x As String, ByVal y As Integer, ByVal z As Integer, ByVal w As Integer, ByRef t As String) As String         If Length(x) < w Then // Definition for Length below           Return t         End If         If y = z Then             t = t + SubStr(x, w, 1) // Definition for SubStr below             z = 1         El...

VS 2008 Setup Project

I have an assembly installed to the GAC. We will always only have one version of this assembly. I have created a setup project to install this assembly to the gac. What I want to happen is for the old version to be removed from the gac before installing the new one. I have done the following: Set the RemovePreviousVersion property o...

Return Type for Collection from LINQ Query

I have a method, that returns a group of accounts Public Shared Function GetAllNotesByUser(ByVal UserID As Guid) As Account (??) Using db As New MyEntity Dim query= (From A In db.Account _ Where A.aspnet_Users.UserId = UserID _ Select A) Return query End Using End Function ...

Sweepstakes algorithm

I am doing a internet cafe sweepstakes slot game in vb.net. I want to show the objects based on the payout and the prize money for paylines in the slot game. I tried using MT algorithem but it basically random number based. the final output should not be radom. Inputs Points Ex. 18 or 50 (2 entries) 9 or 25 (1 Entry) prize (from datab...

ASP Net - Casting a Request.Form control from Code Behind

This seems really simple, but for some reason Im stumped.. Im dynamically generating an HTML Select Box, lets call it myselect. Im creating this select box based on some database values Im generating an HTML Select Box.. almost like a string that Im just spitting out to the page. So it's never a control in the codebehind, just part of a...

Talking to iFrame from ASP.NET code behind

I found this really cool page that allows you to hook up facebook into your site: See here <iframe id="MyIframe" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.EXAMPLE.com%2F&amp;amp;layout=button_count&amp;amp;show_faces=true&amp;amp;width=100&amp;amp;action=recommend&amp;amp;colorscheme=light&amp;amp;height=21" s...

How to tell if a LINQ to SQL query is translated to a SQL statement or not?

We use LINQ to SQL extensively, and one of the biggest performance pitfalls we've run into is situations where a query can't be converted to SQL, and so an entire database table gets loaded into memory and the query performed by .NET. For example, this query Dim Foo = (From c in Db.Contacts Select c Where c.ContactID=MyContactID) tran...

Event handler not firing using AddHandler

I have a form with about 40 checkboxes. Once a checkbox is checked, the div control's property should be changed from "none" to "block" or vice versa. I don't get an error, but the checkedchanged event isn't handled. Here is the markup: <tr> <td class="sectionSubHeader lightgrey"> <asp:CheckBox ID="chkbxCOMAEFund" AutoPostB...

LINQ to SQL mystery: Why does query include all fields in some cases but not others?

This LINQ to SQL query From g In Db.Context.Current.Groups Select g.GroupID generates this SQL: SELECT [t0].[GroupID] FROM [dbo].[Groups] AS [t0] But this query From g In Db.Context.Current.Groups Select g.GroupID, g.MemberCount generates this SQL: SELECT [t0].[GroupID], [t0].[Title], [t0].[Description], ... -- 24 more f...