vb.net

How to avoid IndexOutOfRangeException indexing DataReader columns?

I am having a little trouble with an 'IndexOutOfRangeException'. I think it is because when the code tries to get the DateModified col from the database it sometimes contains NULLS (the users haven't always updated the page since they created it). Here is my code; s = ("select datemodified, maintainedby, email, hitcount from updates wh...

Insert character at start of current line (vb.net)

Currently I have the code: textbox1.text = textbox1.text.insert(textbox1.getfirstcharIndexFromCurrentLine(),";") But this means it has to reload the entire textbox, which with large files is noticeable slow. What are the alternatives? ...

Need a Syncroot for a LinkedList(of T)

Hi I am using VB.Net and would like to use a LinkedList. Only problem is that it is a multithreaded application. I saw from MSDN that Syncroot is an explicit implementation of the ICollection Interface. I found people wanting to do similar things with List(Of T). It seems that the solution there is to cast the list to the interface. I ...

Checking if INSERT INTO statement was successful

I am using a MS Access database as the backend of my VB.NET application. I am entering users details into the database using an INSERT INTO statement: cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & config("DatabasePath") & ";") cn.Open() cmd = New OleDbCommand("INSERT INTO blah blah blah...", cn) dr = cmd.Ex...

How get use graphics in Data Dynamics.ActiveReports 2.0 using VB.Net?

Hi, I am want to apply gradient color on textbox background in active report. For this I use graphics and use following code: Dim a As New System.Drawing.Drawing2D.LinearGradientBrush(New RectangleF(0, 0, Me.Width, Me.Height), color1, color2, mode) Dim g As Graphics = Me.CreateGraphics g.FillRectangle(a, New RectangleF(...

How to make TIMESTAMP from vb.net 2008 using Oracle from oracle.data.client ?

I want to create MySQL like timestamp from vb.net I am using oracle as my database. I also want to insert/update/delete data from the oracle database. Please help me. ...

How do I convert an Integer? to an Integer in VB.NET?

I'm a C# programmer but am converting some code from C# to VB.NET. In c# I can simply use (int)blah.getValue() where getValue() returns an Integer? Doing a DirectCast() in VB.NET doesn't work though, saying Integer? cannot be converted to Integer. Ideas? ...

fluent / nhibernate mapping question

Hey Guys I would very much appreciate some help with the following. We're using fluent to control the mappings for nhibernate and its all gone well so far. We've basically got a scheduled based CMS system and I'm having problems using the HasMany mapping to exclude the non-live child categories. So we have the following Data Tables, s...

asp.net gridview finding cell by datafield name or headertext name when using boundcolumns

is it possible inside the gridview events for commands to find a cell by datafield name or headertext name when using boundcolumns? ...

Help finding a Memory Leak cause

I have the following Leak situation in a VB.NET (.NET2) application: a form - DetailTache (TaskDetails) - in my MDI application is not garbage collected is not collected ofter open/close. I did the following profiling root: any idea how this leak could be fixed? thanks. EDIT: Result search from projet of WinComboRowSelected Event....

How can I make second-level child forms prompt on close?

The problem: A dialog's FormClosing() event is raised if it's a child, ie it's Owner property is set to the parent form, but NOT if it's a child-of-a-child. So closing the main form does not call the closing event on any grandchildren dialogs. The Details: A dialog prompts to "Save Changes?", with YesNoCancel buttons, in the FormClosing...

how to use <DllImport in VB.net?

Hi, how should I DLLImport thing in VB.NET? Example would be: <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Private Shared Function GetWindowText(ByVal hwnd As IntPtr, ByVal lpString As StringBuilder, ByVal cch As Integer) As Integer End Function If I put it inside a Class or somewhere else, I get "DLLimport ...

VB.NET: GetFiles Method - "Access to the path 'G:\System Volume Information' is denied."

Here is my code, Dim allFiles As FileInfo() = tempDir.GetFiles("*.pdf", SearchOption.AllDirectories) I've googled and found that I need to change the permissions of my app from Project properties > View UAC Settings > and change level to level="requireAdministrator" But its also not working. I found somethi...

Static Constructor in VB .Net

I am rewriting a C# class in VB. The C# class has a static constructor in it: static Class() { ... } which, through the Call Stack, I found is called by the main window's InitializeComponent() method. Everywhere I've looked has told me that the corresponding static constructor in VB is just: Shared Sub New() ... End Sub b...

Delegate, BeginInvoke. EndInvoke - How to clean up multiple Async threat calls to the same delegate?

I've created a Delegate that I intend to call Async. Module Level Delegate Sub GetPartListDataFromServer(ByVal dvOriginal As DataView, ByVal ProgramID As Integer) Dim dlgGetPartList As GetPartListDataFromServer The following code I use in a method Dim dlgGetPartList As New GetPartListDataFromServer(AddressOf AsyncThreadMethod_G...

Passing param to delegate method running on new thread .. Am I crossing UI/Thread bounds?

I have a delegate for a method. I start it in a new thread that has a parameter in it in which I pass a DataView into. The new thread is obviously not running on the UI thread so I should not be accessing any UI controls. The dataview I am passing into the delegated method however I got the reference from ComboBox.DataSource where Com...

how do I check that a SqlDataSource returned data?

Hi-- I have a asp.net page that has several SqlDataSources defined that feed data into some graphs. The problem is that the graph product does not handle "no data" very well, and throws an error. I'd like this to handle the situation more gracefully-- so I need to check whether the SqlDataSource returned data or now before rendering the ...

Administer asp.net website (create new users, assign users to roles, etc.) from a windows app

I have an asp.net web app that uses forms-based authentication, a SqlMembershipProvider (using an encrypted password format), and a SqlRoleProvider. I need to know if it's possible to administer the users (create new users, assign them to roles, etc.) from a windows application - the powers that be don't want any administrative functiona...

Is there a way to set a Module to behave like a static class?

This questions is for VBers, it's irrelevant in C#. In VB, when you create a module, all it's fucntions and members are available in the scope without need to type the module name, just like all the VB functions (Rnd, Mid, IIf etc.). I want to create a module but I should have to explicitly write it's name to access it's members, i.e. ...

How to re-run an executable in VB.net

Hello all, I am totally a newbie to VB.net, now I am developping a Windows Service, which will start an *.exe when starting. How can I detect and re-start a process of this executable if it got killed by some other program? My code is as below: Public Class MyWinService Dim RetVal Protected Overrides Sub OnStart(ByVal args() As Stri...