I have an app that uses a listbox to display program status messages, and a
public function to be used by the solution to update the listbox.
I do not know how to make the listbox public so it can be updated by that
function.
public class frmMain : System.Windows. Forms.Form{
public System.Windows. Forms.ListBox listBox1;
I would like to access the listbox to do something like this ( this code
does not work ):
public class ListboxOne{
public void AddMsg(string xMSG) {
PagingDN.frmMai n.listBox1.item s.add(PagingDN. frmMain.listBox 1.Items.Count,x M
SG);
if(PagingDN.frm Main.listBox1.I tems.Count>100) {
PagingDN.frmMai n.listBox1.Clea r();
}
}
} 2 1765
you could try passing a reference to the listbox as shown below:
public class ListboxOne{
public void AddMsg(System.W indows.Forms.Li stBox listBox1,
string xMSG)
{
listBox1.items. add(listBox1.It ems.Count,xM
SG);
if(listBox1.Ite ms.Count>100){
listBox1.Clear( );
}
}
}
hope it helps :)
Shane Sukul
"xzzy" wrote: I have an app that uses a listbox to display program status messages, and a public function to be used by the solution to update the listbox.
I do not know how to make the listbox public so it can be updated by that function.
public class frmMain : System.Windows. Forms.Form{ public System.Windows. Forms.ListBox listBox1;
I would like to access the listbox to do something like this ( this code does not work ): public class ListboxOne{ public void AddMsg(string xMSG) {
PagingDN.frmMai n.listBox1.item s.add(PagingDN. frmMain.listBox 1.Items.Count,x M SG); if(PagingDN.frm Main.listBox1.I tems.Count>100) { PagingDN.frmMai n.listBox1.Clea r(); } } }
System.Windows. Forms.ListBox listBox1
of
public class ListboxOne{
public void AddMsg(System.W indows.Forms.Li stBox listBox1, string
xMSG) {
defines a listBox, but doesn't reference namespace.frmMa in.listBox1
"Shailen Sukul" <Sh**********@d iscussions.micr osoft.com> wrote in message
news:55******** *************** ***********@mic rosoft.com... you could try passing a reference to the listbox as shown below:
public class ListboxOne{ public void AddMsg(System.W indows.Forms.Li stBox listBox1, string xMSG) {
listBox1.items. add(listBox1.It ems.Count,xM SG); if(listBox1.Ite ms.Count>100){ listBox1.Clear( ); } } }
hope it helps :) Shane Sukul
"xzzy" wrote:
I have an app that uses a listbox to display program status messages,
and a public function to be used by the solution to update the listbox.
I do not know how to make the listbox public so it can be updated by
that function.
public class frmMain : System.Windows. Forms.Form{ public System.Windows. Forms.ListBox listBox1;
I would like to access the listbox to do something like this ( this code does not work ): public class ListboxOne{ public void AddMsg(string xMSG) {
PagingDN.frmMai n.listBox1.item s.add(PagingDN. frmMain.listBox 1.Items.Count,x M SG); if(PagingDN.frm Main.listBox1.I tems.Count>100) { PagingDN.frmMai n.listBox1.Clea r(); } } } This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Wishing I was skiing mom |
last post by:
Newbie to VB .NET.
My solution contains an item maintenance screen, one of the fields on the
screen is an item status, this field is defined as a listbox. The listbox
item property contains a collection of status values. If I later pull an
item record from the dataset into this item maintenance screen I cannot seem
to get the status value that is contained in the dataset to display on the
form, it displays the first value in the listbox...
|
by: Oddball |
last post by:
Ok - I have a ListBox control and I'm ready to write my own DrawItem event handler.
What I want to draw as the item is another control. I have created a user control that I
would like to list in this listbox but I can't for the life of me figure out how to draw the
control inside ListBox...
I get as far as:
private void lbImageList_DrawItem(object sender,
System.Windows.Forms.DrawItemEventArgs e)
|
by: Wishing I was skiing mom |
last post by:
Newbie to VB .NET.
My solution contains an item maintenance screen, one of the fields on the
screen is an item status, this field is defined as a listbox. The listbox
item property contains a collection of status values. If I later pull an
item record from the dataset into this item maintenance screen I cannot seem
to get the status value that is contained in the dataset to display on the
form, it displays the first value in the listbox...
|
by: mikeh3275 |
last post by:
I'm creating a .net program that uploads images to the FTP server. A blank listbox is populated dynamically on the client side from the value of the html input file widget. There is also a requiredfieldvalidator on the listbox to make sure there is an item in the listbox. When I click the button to submit, however, the listbox clears itself and a validation error shows. Below is the relevant code in C# plus the Javascript code. Thanks in...
|
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: 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...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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.
| |