Log in

View Full Version : VB.NET app for PPC 2003


pdanford
01-26-2005, 04:39 PM
Hi,

I am building an application to run on a PPC 2003 device using VB.NET

So far I am programaticaly building text boxes to capture data entered by the user. However, for each text box I build I also need to store with it some kind of unique identifier to allow me to do updates later.

In a standard VB.NET app for a PC I could simply name the button:

eg. objButton.Name = "123"

And use this value. However, this is not available when developing against the PPC platform.

Also the Tag property is missing eg. objButton.Tag (which could also be used).

Has anyone else come accross this problem and found a solution. I may have missed something completely obvious!!!

Any help greatly appreciated.

Thanks,
pd

Wiggster
01-26-2005, 06:07 PM
The solution I've had is to create a new custom control with a new string (or whatever datatype you want) that expands upon the existing class.


Namespace MyNamespace
' The MyTextBox Class is identical to the TextBox class, but with the
' new property "Tag", which is used with developer's disgression.
Public partial Class MyTextBox
Inherits TextBox
' Make _tag private so it can be accessed by a method
' to make it friendlier to VS.NET
Private _tag As String
Public Property Tag() As String
Get
Return _tag
End Get
Set (ByVal Value As String)
_tag = value
End Set
End Property
End Class
End Namespace


This means that you can use a MyTextBox exactly like you would a TextBox, and you can use the Tag method to access to _tag member just like you would any other method (such as Size, Text, etc). You can use this method to add any property you want to to existing controls with minimum hassle.

N.B.: I don't program in VB.NET, but I think that's how my C# code translates.

pdanford
01-26-2005, 06:34 PM
Thanks for your suggestion - looks like it will do just the job.

This was one option I thought of, but stumbled when trying to create a custom control that could be used on the PPC.

Did you create a Class Library or a Windows Control Library?

Thanks for your help.
pd.

Wiggster
01-26-2005, 06:38 PM
You'll want to add a new Control class to your project, it's easiest. It's just a basic .CS file with no more than 20 lines of codes.

pdanford
01-26-2005, 06:52 PM
Right. Done that. Works fine!!!

Excellent stuff - thanks a lot for your help. :D