|
|
Here is a user define message in vc++ 6.0 dll, such as WM_USER.
How to delegate the event in C#?
|
|
|
|
|
Hi All,
I want to know how to implement push server architecture using .Net (C#).
|
|
|
|
|
Depends on what you wanna push...
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
I have a distributed client-server application and I want to add all my Binaries and Dlls on the server machine and in case of updating any file server machine will push this updates to clients machine,
i hope you can help me
|
|
|
|
|
Look at the MS Application Updater block.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
what do u mean by MS application updater and where can i find it
|
|
|
|
|
Google is your friend...
Click here[^]
|
|
|
|
|
Goooogle!
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
Have two listboxes lB1, lB2. lB1 is populated with several items.
When user clicks button (btn) the item selected from lB1 will be added to lB2.
A button (btn1) has the following code
***********************
string curItem = lB1.SelectedItem.ToString();
lB2.Items.Add(curItem);
****************************
This compiles fine, but get an error when click btn
ERROR
"Object Reference not set to an instance of an object."
Any help will be greatly appreciated
|
|
|
|
|
Have you tried stepping through the code?
Maybe you don't have any item selected in the first listbox when you click the button?
Matt Gerrans
|
|
|
|
|
This error will happen if you don't have anything selected, or at general the item is null .
"I am a lair" Is this statement true or false ?
|
|
|
|
|
The code works fine if I create the components via VS.NET but I cannot get it to work when I create the controls dynamically. I am sure an item is selected because it gets highlighted.
Here is the way I am doing it
\\code for button to create components
ListBox lB1 = new ListBox();
lB1.Location = new Point(8,24);
lB1.Items.Add("A");
lB1.Items.Add("B");
lB1.Items.Add("C");
ListBox lB2 = new ListBox();
lB2.Location = new Point(8,24);
\\button
Button btn1 = new Button();
btn1.Location = new Point(152,30);
btn1.Text="->";
btn1.Size = new System.Drawing.Size(40,23);
btn1.Click += new System.EventHandler(btn1_Click);
\\when bnt1 clicked
private void btn1_Click(object sender, System.EventArgs e)
{
string curItem = listBox1.SelectedItem.ToString();
listBox2.Items.Add(curItem);
}
|
|
|
|
|
Hi!
What's so difficult about the exception?
The runtime tells you that you're trying to access a null reference, so you better believe it!
I guess it's thrown on the line string curItem = listBox1.SelectedItem.ToString(); simply because you're creating ListBox es named lB1 and lB2 but are accessing listBox1 and listBox2 in your event handler.
mav
|
|
|
|
|
What about trying ?
private void btn1_Click(object sender, System.EventArgs e)
{
lB2.Items.Add(lB1.SelectedItem);
}
Also you have naming error, in lb1 and listBox1, and the same in lb2 // In the btn1_Click code.
"I am a lair" Is this statement true or false ?
|
|
|
|
|
I made a mistake when I posted the code. All references are made to lB1 and lB2 (not listBox1, listBox2).
Just like I said, code works fine when components are created using the visual interface.
I also tried
private void btn1_Click(object sender, System.EventArgs e)
{ lB2.Items.Add(lB1.SelectedItem);
}
still an error.
*****************************************
The code works fine if I create the components via VS.NET but I cannot get it to work when I create the controls dynamically. I am sure an item is selected because it gets highlighted.
Here is the way I am doing it
\\code for button to create components
ListBox lB1 = new ListBox();
lB1.Location = new Point(8,24);
lB1.Items.Add("A");
lB1.Items.Add("B");
lB1.Items.Add("C");
ListBox lB2 = new ListBox();
lB2.Location = new Point(8,24);
\\button
Button btn1 = new Button();
btn1.Location = new Point(152,30);
btn1.Text="->";
btn1.Size = new System.Drawing.Size(40,23);
btn1.Click += new System.EventHandler(btn1_Click);
\\when bnt1 clicked
private void btn1_Click(object sender, System.EventArgs e)
{
string curItem = lB11.SelectedItem.ToString();
lB2.Items.Add(curItem);
}
|
|
|
|
|
try :
private void btn1_Click(object sender, System.EventArgs e)
{
string curItem = lB11.SelectedItem.ToString();
lB2.Items.Insert(curItem);
}
"I am a lair" Is this statement true or false ?
|
|
|
|
|
When I step thru the code. it fails on this line
"string curItem = listBox1.SelectedItem.ToString();"
but I am 100% sure that an item is selected before coninueing.
-I tried the isert, same deal.
How do I trigger an event by just clicking on one of the items, may be I can try this instead of selecting item then click a buton.
THis %$^*)#@#@ is kicking my rear.
thnanks for all good adviced.
|
|
|
|
|
picasso2 wrote: How do I trigger an event by just clicking on one of the items
See the SelectedIndexChanged event of the listbox.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Hello,
I have created a form and want to extend/duplicate it for another use (in the same program). Some of the radio buttons and text boxes have been disabled so the user can't edit them. I would like to create a new form just like this one except this time I will enable these areas. How can I do this? I know how to change the Enabled functions but I don't know exactly how to recreate or extend the current form. Basically I want to have a button on the first form that when clicked, will hide the current form and open the new one with the areas enabled for editing.
Thanks.
|
|
|
|
|
Overload your Form's constructor and do the enabling of radio buttons there. Something like
class MyForm : Form
{
public Form()
{
...
}
public Form(bool enableControls) : this()
{
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
S. Senthil Kumar wrote: public Form(bool enableControls) : this()
So... , I saw many constructors, some of them with :this() , and many wasn't with it.
So what is the function of it ?
"I am a lair" Is this statement true or false ?
|
|
|
|
|
It just means that also another constructor is called before this one:
public MyForm() {
}
public MyForm(bool foo) : this() {
}
Calling the second constructor will first do something and then something else . Leaving this() away from the second constructor would result in just doing something else .
|
|
|
|
|
Nice, thanks very much.
"I am a lair" Is this statement true or false ?
|
|
|
|
|
Hi,
I want to develop an application with menus. I want to make only one event handler method which handles a whole group of menu items by firstly identifying which MenuItem sends the click event and then performing the appropriate action. But I don't find any way to retrieve any info telling me which specific MenuItem sends a click event at the moment. The sender and e parameters seem to carry some very general information, not from a specific MenuItem sending the click event.
This info must exist somewhere, because Windows knows which menu shall be performed at the moment…, but C# seems to hide it for the programmer!
Is there a way to get that info?
Regards,
M Shafaat
|
|
|
|