473,721 Members | 2,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

form objects into class objects

Hi I have created a class that inherits from dictionarybase code below.

Public Class FrmLabels
Inherits Label
Private m_Lbl As Label

Public Property lbl() As Label
Get
Return m_Lbl
End Get
Set(ByVal Value As Label)
m_Lbl = Value
End Set
End Property

Sub New(ByVal lbl As Label)
Me.m_Lbl = m_Lbl
End Sub

End Class

Public Class FrmDDL
Inherits DropDownList
Private m_DDL As DropDownList

Public Property DDL() As DropDownList
Get
Return m_DDL
End Get
Set(ByVal Value As DropDownList)
m_DDL = Value
End Set
End Property

Sub New(ByVal DDL As DropDownList)
Me.m_DDL = m_DDL
End Sub

End Class

Public Class FrmTxt
Inherits HtmlInputText
Private m_DDL As HtmlInputText

Public Property DDL() As HtmlInputText
Get
Return m_DDL
End Get
Set(ByVal Value As HtmlInputText)
m_DDL = Value
End Set
End Property

Sub New(ByVal DDL As HtmlInputText)
Me.m_DDL = m_DDL
End Sub

End Class

Public Class FormDictionary
Inherits DictionaryBase

Sub add(ByVal key As String, ByVal D As Object)
Me.Dictionary.A dd(key, D)
End Sub

Sub remove(ByVal key As String)
Me.Dictionary.R emove(key)
End Sub

Default Property item(ByVal key As String) As Object
Get
Return Me.Dictionary.I tem(key)
End Get
Set(ByVal Value As Object)
Me.Dictionary.I tem(key) = Value
End Set
End Property

Function contains(ByVal key As String) As Boolean
Return Me.Dictionary.C ontains(key)
End Function
End Class

Basically the 3 types of objects i want to pass from my page into a function
defined in another class are label, htmlinputtext and dropdownlist.

and i have this code in my form

For Each ctrl In pnlForm.Control s
If TypeOf ctrl Is HtmlInputText Then
frmDict.add(ctr l.ID, New FrmTxt(CType(ct rl,
HtmlInputText)) )
End If
If TypeOf ctrl Is Label And ctrl.ID <"" Then
frmDict.add(ctr l.ID, New FrmLabels(CType (ctrl,
Label)))
End If
If TypeOf ctrl Is DropDownList Then
frmDict.add(ctr l.ID, New FrmDDL(CType(ct rl,
DropDownList)))
End If
If TypeOf ctrl Is suppliersList Then
frmDict.add(ctr l.ID, ctrl)
End If
Next

This adds each of the objects into the dictionary however i cant get the ID.
I am using the syntax ctype(frmdict.i tem("lblReqBy") , label).ID but it
returns nothing.

I have a web user control on their (SuppliersList) which contains a
dropdownlist, i haven't created a class for this as its only on the page
once, if i use the following syntax

ctype(frmdict.i tem("Suppliers1 "), suppliersList). Controls.Item(0 ).ID

It gives me the ID of the dropdownlist. Can anyone help me out as to why I
can't access the ID property of the controls. Basically I will populate the
text property, selectedvalue property in a function i am writing and modify
the page appropriately, the reason i am doing this is because the same
routine is used on two of my pages and i only want to write it once and stick
it in a class.

TIA
Jul 5 '06 #1
1 1546
Hi i have played around with it this morning and noticed that each of the sub
new in the class was wrong so i changed it to read me.m_lbl = lbl. However i
still had the same issues described

Sub New(ByVal lbl As Label)
Me.m_Lbl = m_Lbl
End Sub

i also changed my for next loop to read

For Each ctrl In pnlForm.Control s
If TypeOf ctrl Is HtmlInputText Then
frmDict.add(ctr l.ID, ctrl)
End If
If TypeOf ctrl Is Label And ctrl.ID <"" Then
frmDict.add(ctr l.ID, ctrl)
End If
If TypeOf ctrl Is DropDownList Then
frmDict.add(ctr l.ID, ctrl)
End If
If TypeOf ctrl Is suppliersList Then
frmDict.add(ctr l.ID, ctrl)
End If
Next

This appears to be working ok, run a few tests in the immediate window. In
my vb.net book it says to create classes like i have done and add them to a
dictionary or collection object. I think the idea is to create early bound
objects i remember something about how it would operate faster, although
there must be something wrong in what i have written so far.

TIA

"steven scaife" wrote:
Hi I have created a class that inherits from dictionarybase code below.

Public Class FrmLabels
Inherits Label
Private m_Lbl As Label

Public Property lbl() As Label
Get
Return m_Lbl
End Get
Set(ByVal Value As Label)
m_Lbl = Value
End Set
End Property

Sub New(ByVal lbl As Label)
Me.m_Lbl = m_Lbl
End Sub

End Class

Public Class FrmDDL
Inherits DropDownList
Private m_DDL As DropDownList

Public Property DDL() As DropDownList
Get
Return m_DDL
End Get
Set(ByVal Value As DropDownList)
m_DDL = Value
End Set
End Property

Sub New(ByVal DDL As DropDownList)
Me.m_DDL = m_DDL
End Sub

End Class

Public Class FrmTxt
Inherits HtmlInputText
Private m_DDL As HtmlInputText

Public Property DDL() As HtmlInputText
Get
Return m_DDL
End Get
Set(ByVal Value As HtmlInputText)
m_DDL = Value
End Set
End Property

Sub New(ByVal DDL As HtmlInputText)
Me.m_DDL = m_DDL
End Sub

End Class

Public Class FormDictionary
Inherits DictionaryBase

Sub add(ByVal key As String, ByVal D As Object)
Me.Dictionary.A dd(key, D)
End Sub

Sub remove(ByVal key As String)
Me.Dictionary.R emove(key)
End Sub

Default Property item(ByVal key As String) As Object
Get
Return Me.Dictionary.I tem(key)
End Get
Set(ByVal Value As Object)
Me.Dictionary.I tem(key) = Value
End Set
End Property

Function contains(ByVal key As String) As Boolean
Return Me.Dictionary.C ontains(key)
End Function
End Class

Basically the 3 types of objects i want to pass from my page into a function
defined in another class are label, htmlinputtext and dropdownlist.

and i have this code in my form

For Each ctrl In pnlForm.Control s
If TypeOf ctrl Is HtmlInputText Then
frmDict.add(ctr l.ID, New FrmTxt(CType(ct rl,
HtmlInputText)) )
End If
If TypeOf ctrl Is Label And ctrl.ID <"" Then
frmDict.add(ctr l.ID, New FrmLabels(CType (ctrl,
Label)))
End If
If TypeOf ctrl Is DropDownList Then
frmDict.add(ctr l.ID, New FrmDDL(CType(ct rl,
DropDownList)))
End If
If TypeOf ctrl Is suppliersList Then
frmDict.add(ctr l.ID, ctrl)
End If
Next

This adds each of the objects into the dictionary however i cant get the ID.
I am using the syntax ctype(frmdict.i tem("lblReqBy") , label).ID but it
returns nothing.

I have a web user control on their (SuppliersList) which contains a
dropdownlist, i haven't created a class for this as its only on the page
once, if i use the following syntax

ctype(frmdict.i tem("Suppliers1 "), suppliersList). Controls.Item(0 ).ID

It gives me the ID of the dropdownlist. Can anyone help me out as to why I
can't access the ID property of the controls. Basically I will populate the
text property, selectedvalue property in a function i am writing and modify
the page appropriately, the reason i am doing this is because the same
routine is used on two of my pages and i only want to write it once and stick
it in a class.

TIA
Jul 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4295
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field that has been modified/clicked the form doesn't always submit. When it does work, a Stored procedure is passed form variables and updates to the db are made. When it doesn't, its as if the form wasn't submitted, it reloads and resets the page, but...
4
2068
by: Dan | last post by:
I'm trying to write a Windows application that obtains information from a web service. I can access the web service successfully, but I can't access the object returned by the web service in different forms. My application is something like this: MainForm.vb: Public Class MainForm
16
11874
by: David Lauberts | last post by:
Hi Wonder if someone has some words of wisdom. I have a access 2002 form that contains 2 graph objects that overlay each other and would like to export them as a JPEG to use in a presentation. I can do this individually for each graph but this does not help me as I need both on the same JPEG. I thought I would try an export the form that contains both but I am having trouble. (My VBA is self taught and a little knowledge is...
2
1537
by: JJ L. | last post by:
Hello. I have a project that consists of nine different objects, each serving their own purpose. In the past I have just created a form for each one, and then whenever you call, say, object.Display(), it would call up the form associated with that object. This form only displays information, it doesn't allow the user to edit any information. Is it possible to find the properties of a certain object, and then loop through creating labels...
0
3149
by: hellind | last post by:
When the form is submitted as ENCTYPE="multipart/form-data" using AspUpload component, I understand to use Upload.form("") to retreive the form elements. But I cannot retreive it from inside a class. Anybody can help? The form page goes to upload.asp, where inside upload.asp it calls the class which reads the form element and return back the values. Here is the code of the class. Class pluginFileTransfer Public path,...
2
1557
by: Jerry Spence1 | last post by:
One way of passing data to a thread is to encapsulate the thread inside a class. However, I can't refer to my main form objects from within the class/thread as it says "Reference to a non-shared member requires an Object reference". How do I refer to items such as Textbox1.text etc on my main form? -Jerry
1
2462
by: Dave | last post by:
I have multiple forms that will create an object. Basically a energy efficiency measure object. The measure object will have a couple of required properties set but after that it can have 10-20 different fields that are optional per measure. How do I account for the different fields that will be posted from the different forms when I create the measure object? Should I create a constructor method with just the required fields as the...
5
4233
by: Rob | last post by:
I have a control (Button) on a Parent form which opens a Windows form... all I want to do is pass a value from the child form back to the parent... it should be so simple... i.e. ParentFormName.Textbox1.text=ChildFormName.TextBoxWhatEver.Text... but nothing like this works. Any ideas ?
7
4157
by: SjaakBanaan | last post by:
Hey guys (m/f), I've got a problem that's been having me pulling out hairs and losing sleep quite some time now. The thing is this. I have a container form with a subform control. This control can take several sub forms as its source object. To make the information, that is generated on one sub form, available to a later sub form, I'm trying to store data in public variables and objects of the container form. In other words, I'm using...
0
8738
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9234
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9086
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8028
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6678
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5994
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2599
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2146
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.