vb.net

C++ dll Loop Problem

Hi there. Im having a problem with a loop inside a C++ dll being called from VB. I want this loop to update a global variable, but when I call the function the variable does not update the first time round, but does so every subsequent time. This is how I am trying to update the variable. else { ::nScore = nHighest; if (nScor...

Migrating from VB6 to .NET, is there an equivlaent function for TreeNode.FirstSibling?

The desktop application I'm migrating makes heavy use of a treeview control, and many calls to TreeNode.FirstSibling, e.g. 'UPGRADE_ISSUE: MSComctlLib.Node property tvTreeView.SelectedItem.FirstSibling was not upgraded. If tvTreeView.SelectedNode.FirstSibling.Index = 1 Then ... End If Is there an equivalent function to use? ...

Dynamic properties for classes in visual basic

Hi, I am a vb.net newbie, so please bear with me. Is it possible to create properties (or attributes) for a class in visual basic (I am using Visual Basic 2005) ? All web searches for metaprogramming led me nowhere. Here is an example to clarify what I mean. public class GenericProps public sub new() ' ??? end sub p...

When is it best to use a new class rather than add to an existing class

I have a class called Player in the business layer of my web application. Player class has fields PlayerID, CategoryID and CountryID A function in Player Class calls a function in PlayerDB Class in the Data Access Layer which in turn calls a stored proc which returns data for PlayerID, CategoryID (foreign key to Category table) and Cou...

Webbased or Thick-client through VPN?

In an electric company where I was hired temporarily, we have to implement an upgrade of the billing and payments system ( the current system is a dbaseIII system). The company's programmer and I have decided to use VB.Net and MySQL. The company served several towns and have billing and payments centers in selected towns. Every billing...

How to Add/Remove reference programmatically?

My Application is built to a scan MS Access database in VB.NET. When the Access application is distributed to end users, they may have different versions of COM components. Is it possible to Add/Remove references programmatically to resolve broken references due to differing versions? Please share me code or link for reference. ...

Best book to learn VB.net for intermediate programmer

Hi All, I need to learn VB.net in Visual Studio 2005 Express for my job. I'm not that good or experienced of a programmer. I've done Basic and Pascal in school. I played with assembly language programming a Motorola HC08 processor a little. For the past 2 years I have done some involved things in Access using VBA. At work we have an o...

VB.NET equivalent of {} nesting

Does VB.NET have any scope nesting operators like {} in C type languages? Example C++ type code: int i; i = 0; { int i; i++; } ...

WinForms App Data Caching - In Which Layer to Cache?

We have data that's updated nightly in a database residing in the same instance as my app's database. So to save on database calls, I want to cache this static-for-the-day data into a List(Of MyObject). From a theory point of view, should this cached List(Of ) be cached in the presentation layer code, via a global variable? Should it be ...

Is it possible to destroy a session variable set by ASP.NET (VB.NET) with Javascript?

As the title states, I have a session variable that is set during a login script with asp.net and vb.net code-behind. Can I call a javascript function when a link is clicked that will destroy that session variable? If it is possible, can I use jQuery to make that process easier? ...

How can I calculate the number of lines in a text box?

I am hoping that someone can help me with a problem I've got at the moment using Compact Framework.Net 2 SP 2. At the moment I have a UI with a series of text boxes and each textbox displays the contents of a database field. These are shown one beneath another with a scroll bar on the right hand side of the form. Each textbox has a set ...

VB.NET List(of X).Contains Behavior

I have a custom class set up as a key that has two properties, X and Y I have something similar to this: Dim test As New List(of TestClass) Dim key as New TestData key._a = A key._b = B For Each a As TestClass In SomeCollection If Not test.Contains(key) Then 'Do Stuff End If Next My question is this: How does the .Contain...

vb.net cycle through query results

I am familiar with the VB6 ADO way of dealing with SQL queries and looping through the record set results. However, what is the correct way to query a server, cycle through the results, and dispose of my query in VB.Net? All the ways I have been using seem to be unstable and crash randomly. I have been using the following code: Public...

How can I pass along the Page Number in a HyperLinkField in a GridView?

I have gridview that I am using paging on. I want to pass along the current page in a asp:Hyperlink so I can send them back to the current page when they are done viewing the details of a record. Is this possible? If it is how can I do this? <asp:GridView ID="grdObitList" runat="server" allowpaging="true" PageSize="10" Aut...

How to copy one Graphics Object into another

I am trying to copy the contents of one graphics object to another, but the only was i have been able to find is based on using GDI32.DLL, which i would rather avoid using if possible. Does anyone know how/if this is possible using managed code? I dont mind if answers are in C# or VB.Net. Here is waht i currently have: Private Sub Co...

What is the best alternative for QueryString

We heard a lot about the vulnerabilities of using QueryStrings and the possible attacks. Aside from that, yesterday, an error irritated me so much that i just decide to stop using QueryStrings, i was passing something like: Dim url As String = "pageName.aspx?type=3&st=34&am=87&m=9" I tried to Response.Write(url) in the redirecting...

How do I treat two similar types as one?

In VB.NET, I am trying to talk to a webservice (that can't be changed) to create and update customer data. The CreateCustomer service expects an object of type ConsumerPerson and the ChangeCustomer service expects an object of type ChangeData. The properties of these two object are exactly the same, so I thought it would be wise to just...

Strange Linq Error

I am using Linq to convert an array of any object to a CSV list: String.Join(",", (From item In objectArray Select item.ToString()).ToArray()) This is giving me the strange error: "Range variable name cannot match the name of a member of the 'Object' class." I can get round it by wrapping the string in a VB StrConv method, with a set...

VB.NET variable scope

Are variables declared in a case statement local to that case statement - For example, in the following code, is it safe to use z like this? Or is the compiler just placing z at the procedure scope? Select Case x Case 6 Dim z As Integer = 6 Case 7 Dim z As Integer = 7 ...

Modify VB property template in VS2008

In VS2008 (VB.NET) when you type Public Property X As SomeType and press enter, VS auto-generates the rest of that property definition for you. I would like to be able to customize what VS generates. Any thoughts on how to go about that? VS must have a template for it somewhere, eh? Thanks. ...