E
eBob.com
I have several applications which mine web sites for personal information
which they publish. They publish the info in one form, I transform the info
into Excel spreadsheets.
So all these programs pick up name, telephone number, age, sex, etc.. And
as they pick up the information they display it in text boxes. The text
boxes are display only, and the info is displayed only for debugging
purposes.
Right now I have a lot of duplicate code in these several applications.
What I'd like to do is create one something, a class library or a user
control, which eliminates all of the duplicate code. So this "something" as
I envision it will be a collection of labels and textboxes (tbxName, tbxTel,
tbxSex, etc.) and a class with corresponding fields (Name, Telephone, Sex,
etc.). The something should also contain related subroutines such as the
code which opens, writes, and closes the Excel spreadsheet.
I wasn't sure if I needed a user control or a class library, but I have
opted for the user control because I want to be able to plonk down the
collection of labels and text boxes during the design of the consuming
applications.
I am now at the point where I have a bunch of labels and text boxes defined
on my "UserControl1.vb[Design]* tab. And now I am trying to define a class
of corresponding fields. So following my "Windows Form Designer generated
code" I have ...
Public Class Person
Private mpName As String
Public Property Name() As String
Get
Return mpName
End Get
Set(ByVal Value As String)
mpName = Value
UserControl1.tbxName = Value '<<<<< this is where I have a problem
End Set
End Property
....
If it matters, note that this Person class is nested within the Public Class
UserControl1. I didn't know classes can be nested but I guess I do now.
I suspect that I am really not going about this in the right way at all.
But, if I am, then my problem is that I do not know how to specify the
controls which correspond to my fields. You'll see above that I tried
UserControl1.tbxName which I knew was wrong, but it at least conveys what I
am trying to do. I had high hopes for me.tbxName but that did not work
either.
So ... any advice or pointers you can share with me will be greatly
appreciated.
Thanks, Bob
which they publish. They publish the info in one form, I transform the info
into Excel spreadsheets.
So all these programs pick up name, telephone number, age, sex, etc.. And
as they pick up the information they display it in text boxes. The text
boxes are display only, and the info is displayed only for debugging
purposes.
Right now I have a lot of duplicate code in these several applications.
What I'd like to do is create one something, a class library or a user
control, which eliminates all of the duplicate code. So this "something" as
I envision it will be a collection of labels and textboxes (tbxName, tbxTel,
tbxSex, etc.) and a class with corresponding fields (Name, Telephone, Sex,
etc.). The something should also contain related subroutines such as the
code which opens, writes, and closes the Excel spreadsheet.
I wasn't sure if I needed a user control or a class library, but I have
opted for the user control because I want to be able to plonk down the
collection of labels and text boxes during the design of the consuming
applications.
I am now at the point where I have a bunch of labels and text boxes defined
on my "UserControl1.vb[Design]* tab. And now I am trying to define a class
of corresponding fields. So following my "Windows Form Designer generated
code" I have ...
Public Class Person
Private mpName As String
Public Property Name() As String
Get
Return mpName
End Get
Set(ByVal Value As String)
mpName = Value
UserControl1.tbxName = Value '<<<<< this is where I have a problem
End Set
End Property
....
If it matters, note that this Person class is nested within the Public Class
UserControl1. I didn't know classes can be nested but I guess I do now.
I suspect that I am really not going about this in the right way at all.
But, if I am, then my problem is that I do not know how to specify the
controls which correspond to my fields. You'll see above that I tried
UserControl1.tbxName which I knew was wrong, but it at least conveys what I
am trying to do. I had high hopes for me.tbxName but that did not work
either.
So ... any advice or pointers you can share with me will be greatly
appreciated.
Thanks, Bob