vb.net

VB.Net Splash Screen Doesn't Go Away

I am using the built in functionality to define a splash screen using vb.net in VS2008. In Me.Startup, I'm calling a function which does a DB version check, then updates if required. This function then writes to a label, using an invoke if required to write the status. Everything functions fine, all the DB updates complete, but the spla...

Looking for feedback from people that have gone from 100% web development to winforms.

I have been a web developer for my entire development career. Nearly 100% microsoft focused the entire time. I have been using .Net, both C# and VB.Net, since beta. I now find myself in a position to where I have the opportunity to start doing some WinForms development in C# using the 3.5 framework. As with anything new, I am excited abo...

Baffling Child object instantiation

I have an object (Incident) which has a child object (Action). An Incident may have zero or or one Action objects. I'm attempting to test whether the Incident object has a child Action object with the following code: If Not MyIncident.Action Is Nothing In theory this should work but for some reason the child Action object is mysterious...

How to mock a method (custom behavior) with Rhino Mocks in VB.NET

How can I mock one method with RhinoMocks in VB.Net? The reference I found is in C#: Expect.Call(delegate{list.Add(0);}).IgnoreArguments() .Do((Action<int>)delegate(int item) { if (item < 0) throw new ArgumentOutOfRangeException(); }); SharpDevelop converts this to: Expect.Call(Function() Do list.Add(0) ...

How should one class request info from another one?

I am working on a VB.NET batch PDF exporting program for CAD drawings. The programs runs fine, but the architecture is a mess. Basically, one big function takes the entire process from start to finish. I would like to make a separate class, or several, to do the exporting work. Here's the problem: Sometimes the pdf file which will be c...

vb.net, option strict, enums and overriding ToString

I have the following code: Public Enum Country Canada = 1 USA = 2 End Enum When I want to see if the user has selected a value, I do: ddl.SelectedValue = Country.Canada Which works fine. However, if I turn on a warning for implicit conversion, this gives a warning. Changing it to ddl.SelectedValue = Country.Canada.ToString...

VB.NET 2005 - "Global" Event Handler?

Suppose that for every Form in a WinForms application, you want to change the cursor to the WaitCursor. The obvious way to do this would be to add the code to every place where a form is instantiated/shown: Try Me.Cursor = Cursors.WaitCursor Dim f As New frmMyForm f.Show() Catch ex As Exception Throw Finally Me.Cur...

Recommended VB.NET Code Generators

Can someone recommend some good VB.net code generation tools? I only need a tool for developing desktop applications. So the web side of things doesn't really concern me too much. ...

How do I code these generic functions and classes inheritances correctly? (VB .NET)

I have a function which I need to call for three different types, with the underlying logic remaining the same for all the different types, so I figured it would be best to write this function using generics. Here is the basic outline of the classes and functions involved: 'PO Base class' Public MustInherit Class ProductionOrder P...

Word Wrapping

I am currently working on creating a web page using .NET 2008. We are getting information from a database and when displaying it I cannot get it to wrap underneath. For example: 2231 Question 1 2232 Mechanical Engineering Technologists and Technicians 2233 Industrial Engineering and Manufacturing Technologists and Technicians ...

SSIS/VB.NET Equivalent of SQL IN (anonymous array.Contains())

I've got some SQL which performs complex logic on combinations of GL account numbers and cost centers like this: WHEN (@IntGLAcct In ( 882001, 882025, 83000154, 83000155, 83000120, 83000130, 83000140, 83000157, 83000010, 83000159, 83000160, 83000161, 83000162, 83000011, 83000166, 83000168, 83000169, 82504000, 82504003, 8250400...

What's bad about the VB With/End With keyword?

In this question, a user commented to never use the With block in VB. Why? ...

Check For File Lock Without A Try Catch

Is there a better way to check if a file is not locked then to open the file to catch an exception. I have a filewatcher running on a directory and I need to do something to the file after the file has completely moved/created in the location. Aren't throwing an exception a performance hit? Is there a better way? Private Function FileAv...

Static keyword, state/instance variables, and thread safety

First of all, the static keyword. I've read several articles and past threads on here covering the static keyword. I haven't found many scenarios listed of when I should use it. All I know is it doesn't create an object on the heap which tells me it would be good from a performance point of view for an object used a lot. Is there any o...

Facebook development toolkit for .net - setinfo

I'm playing with the Facebook development toolkit and I can't get profile.setinfo to work. The documentation is not useful. I'm using the latest source - 28656. Can someone post a VB.Net example for me please? Update: I was asked for a specific problem, so here it is: Setinfo takes a List(Of facebook.Schema.info_field) and info_fi...

How to declare a variable/param of type "Control implementing interface ISomething"?

I wish to declare a variable in such a way as it can be assigned only values which derive from Control and also implement the ISomething interface. I intend to add the ISomething interface to derivatives of controls. I would like to derive SpecialTextBox and SpecialDatePicker From TextBox and DatePicker and implement the ISomething in...

VB.Net Winforms User Control Variable

Hi, I'm using VS 2005 in a VB.Net WinForms application. I have a custom User Control that requires a variable to render its data correctly. My question is, what's the best way to require the calling sub to populate the variable? I've thought of a couple of options: Have a WriteOnly property and check to see if it is "Nothing" when ...

How do I use MSHTML in VB.NET?

In the answer to question #56107, Erlend provided this sample c# code: using mshtml; ... object[] oPageText = { html }; HTMLDocument doc = new HTMLDocumentClass(); IHTMLDocument2 doc2 = (IHTMLDocument2)doc; doc2.write(oPageText); I'd like to use mshtml in VB.NET, but the IDE doesn't recognize this: Imports mshtml What additional st...

Splitting a string of text from textbox using VB.NET

I want to add a text box on a web page in order for users to add space delimited tags. When the user submits the page how do I take the tags out of the text box and add each as a record in a SQL database? I want to use VB.NET. ...

Delay service at system startup.

I'm using VB 9. I want the only thread in my Windows Service (that is set to Automatic) to start its work 5 minutes after Windows starts. But if the user restarts the service manually, the thread should start working immediately when the service starts. How do I achieve this? ...