vb.net

Programmatically choose the class to be instantiate

I am currently playing around with VB.Net using Visual Studio 2010 (.Net 4.0) and I need your help to create a collection class (let's call it 'cl_MyCollection') with a constructor that accepts two arguements: 1) An "SqlDataReader" object 2) Some means of pointing to a custom class I have created The scenario is; I have five database ...

Windows 7 goto Standby Mode

Hi all, I need to standby the remote computer(windows 7) in given time. Can any help me on this scenario. Is it is possible. to do by VB.Net. there are Server and clients... From server machine I need to standby(windows 7) the client system given time. ...

Render Control to Html Produces a different string

I am trying to render a hyperlink to html. ( etc) When the page loads it works fine. (and lots 10 links) on the update panel it hits the same function and tries to get another 10 links. I set the navigationURL to something like "../Folder/Mypage.aspx?498592ghjgfosdfgo" It is set identically both times(load and updatepanel postback)...

Refactoring inheritance to composition using Vbex2005

I have a class that I wrote fairly early on in my vb.net programming experience which inherited from another class it really should have composed. The base class is a relatively generic nested dictionary-based collection; let's call the descendant class a "Car". Right now there's a lot of code that does things like 'MyCar!Color.st = "R...

RichTextBox Highlight All Instances of a Phrase

In VB.Net, is it possible to highlight ALL instances of a phrase instead of only a single instance of it, for example: txtView.SelectionStart = txtView.Find("ERROR: Invalid command entered.") txtView.SelectionColor = Color.Red This would highlight "ERROR: Invalid command entered.", however if my RichTextBox text is: ERROR: In...

How to write a simple Expression-like class in .NET 2.0?

I'm currently working in .NET 2.0 Visual Basic. The current project is an Active Directory Wrapper class library within which I have a Searcher(Of T) generic class that I wish to use to search the underlying directory for objects. In this Searcher(Of T) class I have the following methods: Private Function GetResults() As CustomSet(Of T...

Resizing images and aspect ratio in .net?

I'm using a web cam that takes 320 X 240 pictures. This sort of gives the picture a "landscape" look to them, and I need to re-size the pictures to a 169 X 225 "portrait" picture. Its for a badge program. Anyway, when I re-size the pictures, they get all scrunched up because of the difference in aspect ratio. Is there a way to re-siz...

File association error in VS2008 when trying to use "View Designer"

I have a VB.NET project under Visual Studio 2008. Inside that project, I receive this error: There is no editor available for <filename>. Make sure the application for the file type (.vb) is installed. The error happens whenever I try to bring up the designer view of the form associated with the .VB file. For example, if I double-cl...

including login credentials with a WebRequest

I am trying to "behind the scenes" log myself into a website, from the VB code behind my ASP.NET website. But I am dumbfounded as to how to do this. As far as I know I should be using the WebRequest or Webclient class. That is about as much as I know. I am not sure how to use the class. I want to click a button on my website and have...

How to manage proper code

I have data source and table that I can bind to my controls and datagridview. I can add records to data table and i can view on datagridview but I can't update and Delete records using datagrid. I have following code. If someone can help me i will be really appreciated. Private Sub add_and_update() Dim con As VistaDBConnection ...

Is it possible to deploy an ASP.NET application as desktop application (with server component)

Question: I created an ASP.NET web application. Now it originally was meant for deployment on a webserver. That is working, so, so far so good. My question now is: Is it possible to deploy it as a desktop-application, too? That is to say the installer installs some kind of server, plus the web application, configures the server to run...

How do I map a network drive that requires a username and password in .NET?

I need to map a network drive from within a .NET application. I'm going to need to use an AD Username and Password to authenticate. Usually I just use a batch file with the net use command. How do I do this from within C# or VB.NET code? ...

How to I copy a file from a computer that requires authentication to my local machine?

When I use: File.Copy(strRemoteFolder, strLocalFolder) I get an UnauthorizedAccessException with the following message: "Access to the path ... is denied." In .NET, how do I copy a file from a remote computer that requires authentication to my local machine? I understand that I'm going to need to supply a username and password in so...

Why does my NotifyIcon1_mouseclick event do nothing while executing module Subroutine in Try block?

When I debug my application I am able to use the NotifyIcon1_MouseClick until it reaches a portion of the code. Does Anyone know why it would be doing this and how to resolve it? Here is my main: Module Main Public startdate As DateTime Public oGvar As New cGVar Public Event FinishedWritingTxtFile() Public Event ErrorSendEmail() Publ...

ASP.NET - Send Information to Website

I have an asp.net webpage that only contains a textbox and a button. The user submits their email address using this webpage. What I am trying to do now is take the information submitted by the user and go to another website. Where my "website/program" gives the different website the entered email address, and clicks the submit button. ...

VB.Net Regex Help

I've got 3 or 4 patterns that I'm comparing user input against and I need to figure out if the user input matches one of the patters and to return the match if it does. Since the input is multiline, I'm passing each individual line like so: Dim strRawInput() As String = Split(txtInput.Text, vbCrLf) Dim strInput As String t...

Attaching a custom DependencyProperty to a StackPanel in WPF?

I'm trying to make a mouse over for a stack panel in WPF using a custom DependencyProperty (StackPanels do not handle the MouseEnter event). I've created a class for the DependencyProperty like so: Public Class MouseEnterBehavior Public Shared Property MouseEnterProperty As DependencyProperty = DependencyProperty.RegisterAttached...

VB.NET Bit manipulation: how to extract byte from short?

Given this Short (signed): &Hxxxx I want to: Extract the most right &HxxFF as SByte (signed) Extract the left &H7Fxx as Byte (unsigned) Identify if the most left &H8xxx is positive or negative (bool result) ...

Programmatically add controls to form

I'm using the attached code to add another line\row of controls beneath an existing set (when a label is clicked). There could be quite a few rows added so I'm having to repeat the code many times using the counter (i) to keep track... Is there a better method for doing this? Private Sub Label10_Click(ByVal sender As System.Object, ByV...

Turn on leftmost bit of a Short.

Original question changed. I want to bitwise turn off the left most bit of a Short value (&H8000) and leave the other bits as they are. Dim x = BitConverter.GetBytes(Short.MaxValue Or &H8000) Dim z = BitConverter.ToInt16(x, 0) Isn't there any shorter way with bitwise operators? When I do Dim a = Short.MaxValue Or &H8000 I get a c...