Hi everyone,
I'm having problems, or should I say still having problems with trying to
pass data from my custom buttons in my custom controls to my main form
listview box. Still scratching my head and had a sleepless night trying to
figure this one out. So hopefully someone can help.
I have a user control named Ctr_Horizontal_ Btn.cs (houses my custom buttons)
namespace = HOST_Horizontal _Btn. A public class named =
Ctr_Horizontal_ Btn.cs. This resides on my Windows main form named =
Form1.cs. Namespace is also Ctr_Horizontal_ Btn.cs. There is a ListView Box
named = listView1 on my Form1. What I am trying to do is when I click my
custom button. I want to display in the listView1 with the text of the
button ie: "Hello World".
Unfortunitly I don't seem to have access to the Form1.cs classes, funtions,
etc. I posted yesterday and recieved a reply of :
"this.Parent.Co ntrols[0].Parent[1]" but I am unsure of how to put data into
my listview with this syntax. I can read my listview with it, just can't put
data into my listView1.
Any and all help is appreciated
MikeY 3 2113
MikeY wrote: Hi everyone,
I'm having problems, or should I say still having problems with trying to pass data from my custom buttons in my custom controls to my main form listview box. Still scratching my head and had a sleepless night trying to figure this one out. So hopefully someone can help.
I have a user control named Ctr_Horizontal_ Btn.cs (houses my custom buttons) namespace = HOST_Horizontal _Btn. A public class named = Ctr_Horizontal_ Btn.cs. This resides on my Windows main form named = Form1.cs. Namespace is also Ctr_Horizontal_ Btn.cs. There is a ListView Box named = listView1 on my Form1. What I am trying to do is when I click my custom button. I want to display in the listView1 with the text of the button ie: "Hello World".
Unfortunitly I don't seem to have access to the Form1.cs classes, funtions, etc. I posted yesterday and recieved a reply of : "this.Parent.Co ntrols[0].Parent[1]" but I am unsure of how to put data into my listview with this syntax. I can read my listview with it, just can't put data into my listView1.
You shouldn't do it this way. If the requirement is that the button must
put the text into the listview, then make the listview part of the custom
control. If you want to leave the listview separate from the custom button
control, then have the custom button control raise an event when the button
is clicked, passing the text of the button. The form hosting the controls
would listen for that event and when fired, take the text and put it into
the listview.
--
Tom Porterfield
Txs Tom for your reply. I'll give it a go.
MikeY
"Tom Porterfield" <tp******@mvps. org> wrote in message
news:On******** *****@TK2MSFTNG P10.phx.gbl... MikeY wrote: Hi everyone,
I'm having problems, or should I say still having problems with trying to pass data from my custom buttons in my custom controls to my main form listview box. Still scratching my head and had a sleepless night trying to figure this one out. So hopefully someone can help.
I have a user control named Ctr_Horizontal_ Btn.cs (houses my custom buttons) namespace = HOST_Horizontal _Btn. A public class named = Ctr_Horizontal_ Btn.cs. This resides on my Windows main form named = Form1.cs. Namespace is also Ctr_Horizontal_ Btn.cs. There is a ListView Box named = listView1 on my Form1. What I am trying to do is when I click my custom button. I want to display in the listView1 with the text of the button ie: "Hello World".
Unfortunitly I don't seem to have access to the Form1.cs classes, funtions, etc. I posted yesterday and recieved a reply of : "this.Parent.Co ntrols[0].Parent[1]" but I am unsure of how to put data into my listview with this syntax. I can read my listview with it, just can't put data into my listView1.
You shouldn't do it this way. If the requirement is that the button must put the text into the listview, then make the listview part of the custom control. If you want to leave the listview separate from the custom button control, then have the custom button control raise an event when the button is clicked, passing the text of the button. The form hosting the controls would listen for that event and when fired, take the text and put it into the listview. -- Tom Porterfield
for future readers Delegates are the answer.
MikeY
"MikeY" <mi*******@yaho .com> wrote in message
news:uY******** ***********@new s20.bellglobal. com... Hi everyone,
I'm having problems, or should I say still having problems with trying to pass data from my custom buttons in my custom controls to my main form listview box. Still scratching my head and had a sleepless night trying to figure this one out. So hopefully someone can help.
I have a user control named Ctr_Horizontal_ Btn.cs (houses my custom buttons) namespace = HOST_Horizontal _Btn. A public class named = Ctr_Horizontal_ Btn.cs. This resides on my Windows main form named = Form1.cs. Namespace is also Ctr_Horizontal_ Btn.cs. There is a ListView Box named = listView1 on my Form1. What I am trying to do is when I click my custom button. I want to display in the listView1 with the text of the button ie: "Hello World".
Unfortunitly I don't seem to have access to the Form1.cs classes, funtions, etc. I posted yesterday and recieved a reply of : "this.Parent.Co ntrols[0].Parent[1]" but I am unsure of how to put data into my listview with this syntax. I can read my listview with it, just can't put data into my listView1.
Any and all help is appreciated
MikeY
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Todd Cary |
last post by:
I have a button that creates a new window. The surfer may enter data in
the new window, and if he does, when the window is closed by the surfer,
can the information update fields on the original page - the page/window
from which the new window was created?
I have seen instances where the surfer can open a new window to get
email addresses and these addresses appear in the first window.
Can someone point to an example?
|
by: rettigcd |
last post by:
Hello,
I need to create a custome form that operates similar to the MsgBox()
and InputBox() functions. I can't figure out how to pass data to a
MODAL dialog box (form).
I've tried 3 approaches:
Try #1:
|
by: ehabaziz2001 |
last post by:
I know one of the pointer benefit is that we can return more than one
value from a function . The down program has an error that I can not
discover . That is the call of the function :
The Call:
/*---------*/
weeks_rental ( & customer , & rentdue , &rent_per_week );
The Function:
|
by: Mike Fellows |
last post by:
Ok, im not sure if this is at all possible and if it is how i go about it is
beyond me
i have a piece of client side code that requires a piece of data from the
server side (an ID number in this case)
how can i pass the data from one side to the other, or retrieve it from the
webform on the client side?
i hope ive explained this properly
|
by: DIZZIEDAZZ |
last post by:
Is there a way, I could pass the reference to a pop up window to
another function?
Basically, this is what I want to
var win= window.open("x.htm".....)
SetValue(win,"txtName");
//-------------------------------------------
function SetValue (win, ctlID)
| |
by: John Layton |
last post by:
Hi there,
Is it possible to pass null to a function taking an "out" (or "ref")
parameter in C#. I'd like to do something like the following (which doesn't
compile of course). Thanks in advance.
int SomeValue;
Func(null, SomeValue); // Any way to pass null for either arg?
void Func(out int Param1, out int Param2)
|
by: Anja |
last post by:
Hi everyone,
I have a sub form that references a query to get the results. However,
what I want to do is filter the results further based on a certain
criteria. How can I tell the sub form to filter results based on a
certain criteria.
I tried using the Filter and OrderBy fields in the designer but they
seem to have no affect!
|
by: colin |
last post by:
Hi,
Im tidying up some code ive written wich atm is all in the main form.
its working reasonably well, uses zedgraph wich is nice,
but i need to tidy it up as its become increasingly difficult to work with.
although very fluent in C++ etc, im still geting to grips with c#,
and I think theres probably a better way to do what im trying todo in c#.
so far ive managed to seperate all but the data processing into seperate
clases in...
|
by: John Sheppard |
last post by:
Hello there I was wondering if anyone could help me,
I am trying to pass a typed dataset to a dialoged child form by reference.
I have binding sources sitting on the child form. So to refresh them I just
set their datasource. I am guessing this is probably what is causing the
problem. Is there a better way to do this?
Anyway this all works happily and things show up when the record already
exists but I have 2 problems ;
1) When I add...
|
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: 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: 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();...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |