vb.net

Selected ListItem in Datasource not Selected after DataBinding

I'm selecting a ListItem as I add it to a ListItemCollection. Then I use that ListItemCollection as a datasource for a DropDownlist but the Selected List Item is not being selected after databind. Here is an example of the code: ListItemCollection items = new ListItemCollection(); ListItem item; item = new ListItem("Option 1", "1"); i...

Differences between VB TryCast and C# "as" operator when using LINQ

I have a LINQ query to retrieve the maximum value of an integer column. The column is defined as NOT NULL in the database. However, when using the MAX aggregate function in SQL you will get a NULL result if no rows are returned by the query. Here is a sample LINQ query I am using against the Northwind database to demonstrate what I am d...

project-level conditional compilation constant

I am getting a project-level conditional compilation constant error while trying to build my vb.net project. It reads: project-level conditional compilation constant 'VB_VER=9.0,TARGET="exe",CONFIG="Debug",_MyType="Console",PLATFORM="AnyCPU",DEBUG;^^ ^^ TRACE' not valid: Character is not valid. I recently upgraded it to the latest ve...

Synchronize Excel and XML data?

Hi, I've got an XML file which is a pain to manually update. So I was thinking of creating a small app which synchronizes this data for me based on data from an Excel Sheet or something. Could anyone point me in the right direction for this? Or does some software already exist for this purpose? The XML schema looks like this: <Data> ...

Force parentheses even when calling parameterless functions in VB.NET?

Hi, in VB.NET it is possible to omit parentheses when you call a parameterless function. However this can be very confusing because developers could think that a statement is accessing a property instead of a method. this could result in a performance drop if you are calling the method again and again instead of storing the result in a ...

EventHandler managment in VB.NET

Hi I am right now in an project using VB.NET and needs to translate this C# code into VB.NET oldCommand.CanExecuteChanged -= commandReference.CanExecuteChanged; newCommand.CanExecuteChanged += commandReference.CanExecuteChanged; For me it seems like the an event hooking up on an another event? But I have tried everything to translate...

Loading .net 3.5 wpf-forms in a .net 2.0 application

I'm trying to load and host a WPF control in a .net 2.0 windows forms application. The WPF control should only be loaded if .net 3.5 is installed. I found a link to Hosting WPF Content in an MFC Application and that is about what I'm trying to do but my C++ knowledge isnt sufficient to be able to 'translate' it to .net. Anyway, here is...

mysql backup restore

hello sir i backup mysql table using mysql infile command in vb.net 2005. this is nicely working local database.but connect remote sytem error came. i used code is SELECT * INTO OUTFILE 'D:\Latest\LogSheet\bin\Debug\logsheet_00119082009033114\area_table.txt' FROM area_table if i connect local database is this code execute corre...

How to call Value from web form?

I creat one WEB project, this project contain tow WEB FORM, In the first Web Form Design i have tow TextBox for Entring the date(All dataTable between this tow dates) and one Button, I want that when i press to to this Button it will load the second WEB FORM and show all the Data Table in DataGrid In this WEB FORM, So i need To call this...

How to clone subscribtions to object's events is vs.net?

I have a custom datagridviewcolumn in which i've added an event. The problem is, I can't work out how to see who has subscribed to the current column object's event and add those subscriptions to the cloned column object. I get around this problem by asking the calling program to pass the address of the handler to a delegate in the cust...

Prevent Screen flickering during event

Hey guys, I know that in primitive versions of vb (as found in excel) there was a line that you could insert to prevent screens from flickering to and fro when it is trying to process something. Application.screenupdating = false I am currently using vb.net in Visual Studio 2008 but i was wondering if anyone knows the equivilent for th...

Using a query string in an excel hyperlink to an ASP.Net Web Application

I want to pass some data between an existing excel application and an existing ASP.Net VB Webforms application. I thought a hyperlink with some query string variables would be the most straightforward means of doing this. However, it seems that the hyperlink does not retain the session of the logged in user. Testing this with the same ...

VB.Net: Does Debug.Writeline stop Thread execution?

I have a vb.net application that uses threads to asynchronously process some tasks in a "Scheduled Task" (console application). We are limiting this app to run 10 threads at once, like so: (pseudo-code) - create a generic list of 10 threads - spawn off the threadproc for each one - do a thread.join statement for each thread to wait ...

How can I call a sqlserver function from VB.net(or C#) ? Is there some syntax like stored procedure?

Public Sub cleanTables(ByVal prOKDel As Short) Dim sqlParams(1) As SqlParameter Dim sqlProcName As String sqlProcName = "db.dbo.sp_mySP" sqlParams(1) = New SqlParameter("@OKDel", prOKDel) Try dbConn.SetCommandTimeOut(0) dbConn.ExecuteNonQuery(CommandType.StoredProcedure, sqlProcName, sqlParams) ...

VB, VB.NET, Lotus Script: Script to copy address entries.

I am looking for the possibility to copy all (backup) my address book entries into plain text, or CSV, or XLS from Lotus Notes mail client. My aim is to later copy these details into Outlook. Is it possible. I haven't done lotus scripting before. But I am going through the reference links. If possible provide links or pointers for accom...

Dropdownlist results in gridview

I'm having some trouble getting the results of the drop-downs in a gridview, and haven't found any helpful articles for VB code. What I'm trying to do is build a site for tests. So far I have the gridview built w/the extra column for a drop-down list where the true/false answer will be selected. When the test is completed, there is a su...

writing 10mb to application settings?

is this a good idea or not really? instead of having to open a file through filestream, i would like to just save text in an encrypted format in application settings. is this OK if the text is under 10mb? what would be the best way of implementing this? ...

VB.NET Rich TextBox Newline Character removal

I am using a Rich TextBox in VB.NET and passing to a StringBuilder. I need to replace the New Line character from the TextBox with either a space or a comma. Problem is the standard codes for new line don't seem to be picking up this New Line character in this case. Is there a specific character used in Rich TextBoxes as the New Line? An...

Select Case on an object's Type in VB.Net

I'm not sure if this valid C# but hopefully you get the idea. :) switch (msg.GetType()) { case ClassA: // blah case ClassB: // blah 2 case ClassC: // blah 3 } How would I switch on an object's type but using VB.NET's Select Case? I'm aware that some might suggest using polymorphism but I'm using a ...

DPAPI encryption not working so well with my.settings

when my.settings.datastorage has nothing in it, this works fine. but after i go through this twice, it gives me an error total_string = "some string" My.Settings.datastorage = My.Settings.datastorage & DPAPI.Encrypt(total_string) My.Settings.Save() MsgBox(DPAPI.Decrypt(My.Settings.datastorage)) this is the error it gives: "Invalid ch...