vb.net

using sqldatareader instead of recordset vb.net

I am new to this and had this question. Can i use SQLDataReader instead of a Recordset. I want to achieve the following result in an SQLDataReader. Dim dbConn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim sqlstr As String = "SELECT Name,Status FROM table1 WHERE id=" + item_id.Value.ToString rs.Open(SQL, dbConn) While Not rs....

String Split & Search VB.NET

Need to take a string in vb and split it. Also need to look through the two returned values and return the value which contains "domain1.com". Pipelines are the delimiter. txtEmailFrom.Text = "[email protected]|[email protected]" Dim brokened() As String brokened = Split(txtEmailFrom.Text, "|") Dont know where to go from here... ...

Sorting Listbox Items numerically in VB

Hi, I need to sort the items in a visual basic listbox numerically, that is, I have a collection of numbers I would like to be sorted increasingly. I tried to simply use the listbox's Sorted property, but found that it treated the numbers as if they were strings, that is, it would look at the first digit, then the second, etc. to det...

Compiling .NET app as 32-bit only so I can use my Access DB

I keep getting this error when I try and use a MS Access database in my application: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. After Google'ing the error for a while I came to see that this is a problem when running the application in 64-bit mode. If I was to compile the app in 32-bit it wou...

For each line in selected lines (vb.net)

how can I get the lines which are have selected text in them? For example: The selected lines would be 1, 2,3 and 4 (0 being the first line) How can I get to code like: For Each line as string(or integer) in textbox1."SelectedLines" 'Do something here for each line Next Thanks ...

Running SQL query from Module with a function call from my Form

I have a form set up where I want to run the function PopulateGrid on it's Form_Load event. I have initialized the DB connection as follows: Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load LoadConfigFile() cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Sourc...

Class-level Static Variable per Instance.

Hi, I'm trying to do the following: I need a static variable to get a ListItemCollection from a List control (I can do this, but if I don't set it as Shared It's not preserving the values as it should). The thing is that this class is a SharePoint webpart, so I most probably will be using the webpart more than once, and I need this vari...

saving checkbox values in vb.net

i have 50 checkboxes for 50 american states. The user can choose all 50 or only 1( so basically any number he wants). Based on his choice, I want to insert or update the table in sql server 2008. e.g- Color = blue and chk1=check, chk2= check and chk3 = check (chk = checkbox). now the user wants to ad 10 more states to this or remove the...

how to save multiple checkbox values in one while or for loop in vb.net

i have 50 checkboxes for 50 american states. The user can choose all 50 or only 1( so basically any number he wants). Based on his choice, I want to insert or update the table in sql server 2008. e.g- Color = blue and chk1=check, chk2= check and chk3 = check (chk = checkbox). now the user wants to ad 10 more states to this or remove the...

how to access remote registry access between xp and vista using vb.net?

I have to access remote connection from XP os to Vista os in vb.net How to do that? ...

How can i convert pdf file into xls through coding using vb.net.

I want to convert pdf file into xls using vb.net. How can i do it? I don't want any third party software. ...

Are any of these SQL Queries open to SQL injection attacks?

I have re-written my code after great help from some friendly stack overflow members (big thanks to Martin B and Kev Chadders especially). I would now like to check if my code is still open to SQL Injections after this work. I believe the code is now working as it should, but any blinding errors that you see i'd love to hear about too. M...

Shared files to bytes array

I use this function to convert file to bytes array: Public Function ConvertToBytes(ByVal path As String) As Byte() Dim _tempByte() As Byte = Nothing If String.IsNullOrEmpty(path) = True Then Throw New ArgumentNullException("File not exist", path ) Return Nothing End If Try ...

Which one is faster DataTable or ArrayList? searching point of view.

i have got any no of records in datatable with id field and other fields.. and i have got a arraylist which have got all id of datatable's records.. now i need to check that the perticular id exist in records or not.. for that i can check in datatable or i can check in arraylist (because arrylist also contain all those ids).. so please t...

asp.net GridView not showing data from Stored Procedure

I have two GridViews, the first works fine as I defined the datasource when I dropped it onto the asp page via visual studio and I specified the table to use. The other GridView (dgvParams below) has just been dropped onto the asp page and I want to use it at run time: Imports System.Data Imports System.Data.SqlClient Imports myDataBas...

Vb.net - Select listbox item based on string

Hi, I'm trying to write a small app which can be used in order to log off Citrix Sessions. Citrix Sessions can be logged off via cmd or a batch file using this method: @echo off echo "Enter username" set /p UserName= echo 001 query user %username% /server:server1 echo 002 query user %username% /server:server2 echo 003 query user %user...

redirect after webmethode

Hi, I'm using javascript to send a array to my code behind so it can be saved. And also to redirecting the page to the next dataset. function ChangeMonth(utcDate){ PageMethods.javaGetArray(colors); alert("saving..."); window.location = "./transport.aspx?date=" + utcDate; } This works perfectly when there's ...

Pick up strings from cmd command? Process.StartInfo

Hi, so I've tried Process and starting a cmd.exe and send commands directly to that window. And then picking up the values written to the cmd.exe window. The code looks like this: Dim arrServers As ArrayList Dim s(ListBoxServers.Items.Count) As String ListBoxServers.Items.CopyTo(s, 0) arrServers = New ArrayList(s) Us...

Group join with multiple conditions and one of them being with a constant

Here is a snippet of my (VB) LINQ: From event_evn In xmlEvents.Descendants("event_evn") _ Join genre_gnr In xmlGenre.Descendants("genre_gnr") On event_evn.Element("evn_gnr_id") Equals genre_gnr.Element("gnr_id").Value _ Group Join eventdata_eda In xmlEventData.Descendants("eventdata_eda") On _ eventdata_eda.Element("eda_evn_id").Value E...

GetInvocationList of an event in VB.NET

Hello, I am trying to learn some WCF principles by following an example of a WCF application (from Sacha Barber). Now I would like to convert the following function into VB.NET private void BroadcastMessage(ChatEventArgs e) { ChatEventHandler temp = ChatEvent; if (temp != null) { foreach (ChatEventHandler handl...