vb.net

Can I stop a program during execution any other way than by throwing an error?

Is there a command that will stop the execution of my program? I have a service that is processes an exchange account via telnet every 10 minutes. During one point of execution the application could possibly have a response from the telnet session when there are NO e-mails in the folder, which would look something like this: * 0 EXIST...

Stream sound from internet / server (and passing to nAudio soundplayer)

Hi, I'm trying to create a sound application, somewhat like Spotify using nAudio open source library. The application is only intended as a personal archive of my own song ideas. Most functionality works great but the WaveChannel32(New WaveFileReader) doesn't support URLs it seems. Now, the sound files themselves lie in a folder on a ...

Calling Windows SDK GetGlyphIndices from VB.Net

I am calling GetGlyphIndices from Vb.Net. I am using a single character string. I get the correct value in the indices array for the character '6' but not for characters requiring 2 bytes to be returned. Does anyone have any experience with this API call? My next step is to write the C equivalent and make sure I can get it working witho...

How do I add a newline to a windows-forms TextBox?

I am trying to add a line of text to a TextBox component in VB.net, but I cannot figure out for the life of me how to force a new line. Right now it just adds onto what I have already, and that is not good. I have tried copying the actual linebreaks, didn't work. I tried AppendText(), didn't work. How on earth do I do this? It is multi...

How can I keep a VB.NET class in a central location and reference it from multiple websites?

We have several VB.NET websites running internal applications. These sites are often modified with minor changes, and are maintained on the server as uncompiled code. I'm looking for the best way to maintain classes so that we can reference them from multiple websites. Specifically, we're looking to put some common functions (error lo...

Help With DataSet GetXML function

I have a dataset which I am populating via an Oracle SQL query: SELECT col_id, col_desc FROM table_data; Then I generate the dataset, via the function Dim ds as New DataSet OracleDataAdapter.Fill(ds) Now, when I get the XML of the generated dataset via: Dim strXML as String strXML = ds.GetXML() When I read/display the string, i...

Simulating a 'Where' clause in a For Each loop in VB.NET

Is it possible to have something similar to an SQL 'WHERE' clause in a For Each loop in VB.NET? I.E. FOR EACH event IN events 'WHERE eventdate=getdate NEXT ...

How to store current user information, security, and preferences

I need to have the ability to have a Global variable/class that stores some basic information about the currently logged in user including that user's preferences, security rights, UserID, etc. This information will be needed by any/every part of my application. In the past I have either used a Public variable/class in a vb.net module ...

How to set datasource of a datalist in javascript

Hi guys, I have a datalist. I have datatable in javascript. I want to set datatable as datasource to datalist in javascript. Is it possible? Can anybody help? ...

How do I use id's of HTML elements in another sub when they are created from server-side code?

I have a table that I'm creating in code behind with the final column containing a HTML checkbox with runat="server". The code I'm using to do this is: Do While reader.HasRows Do While reader.Read Dim tNewRow As New HtmlTableRow Dim cellSKU, cellDESCR, cellDept1, cellDeptGrp1, cellDep...

Inserting a date into an access db in vb

Hi, Im a little stuck and I dont know what im doing wrong. I want to insert the current date into a MS Access database in VB. The part of the code im having trouble with is: SQLString = "INSERT INTO Sales(DateSold) VALUES (" SQLString += Date.Today & ")" The type in the database is date and is dd/mm/year. Thanks in advance for the...

Getting my screens' name in c#

I am aware of the Screen class, but when trying to use Screen.AllScreens[0], I get something like .\Device1. Instead, I'd like to have my screen's name, something like HP 24' something. How can that be done? Thanks ...

Best Practice on IF/ELSE Statement Order

Which is a better practice? (I'm coding in .Net if that makes a difference) IF condition = true THEN ...true action--even if rare... ELSE ...action END IF or IF condition = [most common condition] THEN ...most common action.... ELSE ...least common action END IF ...

Need to rotate text in a label every time user refresh the page.

I have a label called lblMessage. The data of the message is saved in a SQL Server 2005 DB. In my table i have a message ID and then 4 rows with my message ID. Message 1, Message 2, Message 3 and Message 4. I want my lblMessage to go through a loop every time the user refresh his browser, so that when he refresh it once the next message...

Save a datatable to excel sheet in vb.net winform application

A year ago I saw a beautiful simple code that gets a data table and saves it in an excel file. The trick was to use the web library (something with http) and I'm almost sure it was a stream. I find a lot of code with response but I can't make it work in a win-form environment. There is also a cell by cell code - not interested -too sl...

Where can I find good Visual Basic .NET tutorials?

I need VB.NET tutorials and simple VB.NET examples. I am trying to implement click events like: Add button Edit button Delete button Upload button Where can I get started with this? ...

FtpWebRequest move file

I am putting together a simple app and I have it working for uploading, downloading, deleting files using FtpWebRequest. But I cannot find how to move a file using FtpWebRequest. What is the simplest way to move a file from one dir to another without using another external dependancy? Thanks in advance. ...

Trying to attach to my windows service but shows as disabled in available processes.

I'm trying to attach to a windows service I am running to debug it however the "Available Processes" list under "Attach to Process" it shows as disabled and won't allow me to attach. What am I missing? ...

How would you obtain the first and last items in a Queue?

Say I have a rolling collection of values where I specify the size of the collection and any time a new value is added, any old values beyond this specified size are dropped off. Obviously (and I've tested this) the best type of collection to use for this behavior is a Queue: myQueue.Enqueue(newValue) If myQueue.Count > specifiedSize Th...

class not registered

I am installing an application on a client machine. The application is throwing an exception that I am logging that states "Class Not Registered". This an app written in Visual Studio 2005 using VB.NET. The dll dependencies of my .exe are located in the same folder as the .exe. What class is this talking about and how can I resolve t...