I'm new to vb.net and would like the advice of my peers. Here is my
scenario: I have a user control which consists of three buttons, three
listboxes and three labels. When the user selects a button an associated
listbox is made visible. The user can then select her choices which will be
used for a reporting filter down the line. I've created a user control to
house these controls and put the user control on a form, I will have perhaps
4 different user controls later. I've create a class called clsCustomCtl
which has two classes in it, one for button which inherits button and one
for listbox which inherits listbox. I then instantiate these classes in my
user control making my controls of the class type, clsButton or clsList.
Here is my code below, am I coding this in a correct manner? I'm a stickler
for coding style, but being new to .net I would love some advice. Through a
property assignment I'm assigning each button a list box and each list box
I'm assigning a label control showing whether the listbox items were
selected are not. I assume since the button has control over the listbox,
doing it in this manner allows the same functionality for all buttons
derived from clsButton. All the button does is toggles the visible property
showing it's assigned list box control and as Items are selected in the
listbox the label displays text of some kind. Thanks you for taking the
time, sorry so verbose.
Code from User Control:
Private Sub IntitializeCtls ()
Me.ListBox1.uLa bel = Me.Label1
Me.ListBox2.uLa bel = Me.Label2
Me.ListBox3.uLa bel = Me.Label3
Me.Button1.uLis tBox = Me.ListBox1
Me.Button3.uLis tBox = Me.ListBox3
Me.Button2.uLis tBox = Me.ListBox2
End Sub
CLASS CODE:
Imports System.Windows. Forms
Public Class clsButton
Inherits Windows.Forms.B utton
Private _lst As ListBox
Public Property uListBox() As ListBox
Get
Return _lst
End Get
Set(ByVal Value As ListBox)
_lst = Value
End Set
End Property
Public Sub New()
MyBase.New()
RemoveHandler Me.Click, AddressOf Button_click
AddHandler Me.Click, AddressOf Button_click
End Sub
Private Sub Button_click(By Val sender As System.Object, ByVal e As
System.EventArg s)
Me.uListBox.Vis ible = True
Me.uListBox.Bri ngToFront()
If Me.uListBox.Vis ible Then
Me.uLabel.Visib le = True
Else
Me.uLabel.Visib le = False
End If
End Sub
End Class
Public Class clsList
Inherits Windows.Forms.L istBox
Private _lbl As Label
Public Property uLabel() As Label
Get
Return _lbl
End Get
Set(ByVal Value As Label)
_lbl = Value
End Set
End Property
Public Sub New()
MyBase.New()
MyBase.Selectio nMode = SelectionMode.M ultiSimple
RemoveHandler Me.Click, AddressOf clsList_Click
AddHandler Me.Click, AddressOf clsList_Click
End Sub
Private Sub clsList_Click(B yVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Click
Me.uLabel.Text = "Filtered"
End Sub
End Class 0 1073 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jeff Wagner |
last post by:
I am in the process of learning Python (obsessively so). I've been through a few tutorials and read
a Python book that was lent to me. I am now trying to put what I've learned to use by rewriting that
Numerology program I wrote years ago in VB.
There are times I am totally stuck (for instance, I just had an idea to put the numerical values of
the alphabet and months of the year in a dictionary located in a function. Then, I can import the...
|
by: Laban |
last post by:
Hi,
I find myself using static methods more than I probably should, so I am
looking for some advice on a better approach.
For example, I am writing an app that involves quite a bit of database
operations on purchase orders and inventory. I have created a PurchaseOrder
class and Inventory class to encapsulate operations like creating POs,
finding items, etc. These two classes are used extensively from different
parts of the app.
|
by: Brian |
last post by:
NOTE ALSO POSTED IN
microsoft.public.dotnet.framework.aspnet.buildingcontrols
I have solved most of my Server Control Collection property issues.
I wrote an HTML page that describes all of the problems that I have
encountered to date and the solutions (if any) that I found.
http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm
This page also has all of the source code in a compressed file that you are
free to download...
|
by: TobyRiley |
last post by:
Can anyone offer some advice on this.
I have a large web based application, 100+ aspx pages, 100's of
webUserControls etc. While all of the system is structued & layered as n-tier
we cannot seem to spilt the web application up into discreet modules. i.e.
there is a core services framework that all areas of the application use but
majoiry of the modules we have in the application are standalone or talk to
other modules through variuos...
|
by: Web_PDE_Eric |
last post by:
I don't know where to go, or what to buy, so plz re-direct me if I'm in the
wrong place.
I want to do high performance integration of partial differential eqns in n
dimensions (n=0,1,2,3..etc) I want to do (fast) graphic output of the results.
I used to use C. I want to upgrade my computer.
Do I get dual core? Does C# support dual-core? Is C# as fast as the old C?
Is there a new C? (or is C# the new version of C?) Is Visual Studio...
| |
by: Alan Silver |
last post by:
Hello,
MSDN (amongst other places) is full of helpful advice on ways to do data
access, but they all seem geared to wards enterprise applications. Maybe
I'm in a minority, but I don't have those sorts of clients. Mine are all
small businesses whose sites will never reach those sorts of scales. I
deal with businesses whose sites get maybe a few hundred visitors per
day (some not even that much) and get no more than ten orders per day....
|
by: george.leithead |
last post by:
Hi all,
I'm looking for some advice on how best to achitect the following
requirement.
I'm basically writing a Fantasy Football (FF) Web site, and would like
to have it fully OO and have it using as much inheritance, base
classes, common methods, etc as possible.
My biggest headache that I cant get my head around is how to handle
|
by: dydx31 |
last post by:
Hey guys,
I am a Computer Science student attending classes at the University
of Michigan-Dearborn. I have been in college for a few years now,
but I have some questions for you. I am really struggling with my
programming classes. Its hard to describe...I can understand small
scale programs, but when it comes to designing an application like
itunes(just as an example) I'm lost.
If someone came up to me and said I want you to design...
|
by: auratius |
last post by:
http://www.auratius.co.za/CSharpCodingStandards.html
Complete CSharp Coding Standards
1. Naming Conventions and Styles
2. Coding Practices
3. Project Settings and Project Structure
4. Framework-Specific Guidelines
Naming Conventions and Styles
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |