vb.net

vb .net overwrite a specific line in a text file

Following hot on the heels of my question about how to read from a line in vb .net, I need to do the following: change the line in a text file [Path] = "c:\this\certain\path\" with this line [Path] = "c:\that\other\newer\path\" these paths will most certainly be different lengths, so I need to either replace what's in the quotes ...

Inheriting a VB class in C# and overriding constructors that take optional parameters

This is kind of complicated so please bear with me. The Setup most of our code base is in VB.net. I'm developing a project in c# that uses a lot of the assemblies from the VB.net code. There are three relevant classes in VB.net Public MustInherit Class mdTable Public Sub New(ByVal sqlConnectionStr As String, Optional ByVal maxSec...

How do I handle application security? using ActionFilterAttribute and/or SiteMap authorization..?

Hi, i created the following ActionFilterAttribute to check if a user is granted access to a page. I also created two custom Exceptions to handle different scenarios: NotLoggedInException and InsufficientPrivilegeException. ActionFilterAttribute Public Class ValidateAuthentication : Inherits ActionFilterAttribute Private _page As B...

How can I get the printer HDC

I have a COM component written in C++ that has a Print function. This print function takes the Printer hDC as a parameter that includes all settings to use for the print. Previously, this was called from VB6 code, and Printer.hdc would work here after setting everything on the Printer object. The code was converted from VB6 to VB.NET, a...

[ASP.NET] Application variables global to Webgarden

Hello, I am currently trying to program an online drawing program using the HTML5 canvas. The thing is, I need to have the current canvas saved somewhere globally. Static variables work, but they do not get shared across a Webgarden. This results in two different drawings being created. I will have to somehow create a new application...

Changing culture when switching view

I am working on a website web site where each user has a culture setting to allow control of resources displayed. The main page has two views, one the log on screen, the second the main menu. When first loaded the page displays with the culture settings of the previous user (if any). If I then log on as a user with a different culture ...

Saving image: A generic error occurred in GDI+. (vb.net)

I need to save an image after opening it in from an OFD. This is my code atm: Dim ofd As New OpenFileDialog ofd.Multiselect = True ofd.ShowDialog() For Each File In ofd.FileNames Image.FromFile(File).Save("C:\Users\Jonathan\Desktop\e\tmp.png", Imaging.ImageFormat.png) Next And on the line Image.FromFile(File).Save("C:\Users\Jonat...

Get the name of the current method

This is kind of a silly question, but is it possible to get the name of the method that is currently being executed from within that method? Public Sub SomeMethod() Dim methodName as String = System.Reflection.[function to get the current method name here?] End Sub Thanks ...

save context menu items in my.settings vb.net

How can I store the items in a context menu strip in the Settings so they are in the context menu when the application is next started? Or is there a better way than using settings? (they are recently opened files in the cms) ...

Access denied in SQL 2008 on image write

I have create my code in order to write images in a remote sql server All the details of accessing and writing are fine until now, including the system account right now i'm in the command of: SqlFileStream = New SqlFileStream(filePathName, fileToken, FileAccess.Write) and when i'm trying to execute it the Server returns the error 'A...

How can I write these to my database as Null instead of Nothing

Hi Everyone, How can I change the following code to write to the database null instead of empty strings? Public Sub SetChangeRequest(ByVal referenceLeaseID As Integer, _ ByVal referenceCustomerID As Integer, _ Optional ByVal custUnitNum As Object = Nothing, _ ...

override a class/add properties to a ListviewItem (vb.net)

I have a listview but I would like to add 3 properties (for example one of them is "image") to the listviewitems in it. I was fine with making a custom class with the 3 properties and just inheriting ListViewItem but now I need to use MultiSelect, so it means doing things like(in For Each loops): ListView1.SelectedItems.Item(i).Image do...

custom AuthorizeAttribute + custom SiteMapProvider related?

I have a custom SiteMapProvider (populated from database) and a custom AuthorizeAttribute (validates current users roles + requested page against Role_Page database) for controller classes. I have to implement the function SiteMapProvider.IsAccessibleToUser(context, node). I also have to implement AuthorizeAttribute.AuthorizeCore(contex...

Editing row of a datagrid in ASP.Net VB.Net

Hi All, I'm working on a piece of code at the moment that uses an older style DataGrid to allow the user to enter information into the table. It already has an add and delete button. Currently the user enters information into 3 textboxes that are in the footer, and the other rows use labels to display the information. Essentially what ...

VB.NET 'With' statement performance?

What's the performance consequence using the 'With' keyword in vb.net instead of using reusing the instance name over and over? ...

How to call or update from a fucntion ????

I have a asp.net VB code to insert draft/saved messages into a a new table created for draft messages database. I want to check if the the record exists before it is saved. So i have made a function (selecting the unique record ) .Now how do i call this function and update the values, it is showing me the error 'Conversion from string "s...

Password protection for shared folder!

Hi! I am using this functions for sharing folder: Protected Sub CreateShare(ByVal path As String, ByVal shareName As String) ' Create a ManagementClass object Dim managementClass As New ManagementClass("Win32_Share") ' Create ManagementBaseObjects for in and out parameters Dim inParams As ManagementBase...

replace keyword within html string.

I am looking for a way to replace keywords within a html string with a variable. At the moment i am using the following example. returnString = Replace(message, "[CustomerName]", customerName, CompareMethod.Text) The above will work fine if the html block is spread fully across the keyword. eg. <b>[CustomerName]</b> However if the...

Why File System Watcher is almost blind?

I am using FileSystemWatcher in order renaming files within a Watched directory. The problem occurs if the number of files copied simultaneously to the watched directory exceeds the number of 50... The rename event is fired successfully for the first 50 files, but after that nothing happens Any suggestions please? ...

My.Forms Question.

My current project has 10 or so forms, however when using the itellisense within visual studio only 3 show up within the My.Forms property. I would have imagined that the forms would have been added to this as they are added to the project. Is there a setting somewhere which needs to tweaked to ensure they show up? ...