|
There has no OnInsert or AfterInsert, but listbox has ControlAdded and ControlRemoved, see if it's help.
|
|
|
|
|
I have looked at both events(ControlAdded and ControlRemoved) prior to my post, the documentation states they are for controls, not items. How to get notified after new item has been added to the listbox ?
|
|
|
|
|
Deian wrote: I have looked at both events(ControlAdded and ControlRemoved) prior to my post, the documentation states they are for controls, not items. How to get notified after new item has been added to the listbox ?
I had encountered the same problem before. I couldn't find any such event that was usable. What I ended up doing, while it was extremely generic, was take a collection of all the items in the listbox, and compare the collection and the list, and when the count is different, you can "fire your event." It is pretty simple to find the item that has been added or removed.
Like I said, it is pretty generic and crappy. But, it got the job done. Worked just fine for me.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thanks for the replies. There are several ways to get out of the situation, but I tought that I am missing something when reading the documentation.
Regards,
Deian
|
|
|
|
|
Deian wrote: I tought that I am missing something when reading the documentation.
Oh, unfortunately, and strangely enough, you are not.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
hi
My aim is to bind the combobox with two fileds of a database
i mean that whenever i click on the combobox , the boxes must contain two fields .....example of that is a name with its id ....
if anyone is having any idea abt this then please let me know
regards
sindhu tiwari
its me sid
|
|
|
|
|
Are you want the combobox contain the display and the id of the display name?
If so, set the DisplayMember and ValueMember to the combobox. When SelectedIndexChanged you can get the SelectedText and SelectedValue
|
|
|
|
|
I am using the concept of satellite assembly in my application.I have created two satellite assemblies as Satellite.fr-FR.resources.dll and Satellite.en-US.resources.dll for french and english respectively.
I have initialize resource manager as:-
ResourceManager rm = new ResourceManager("Satellite." + System.Globalization.CultureInfo.CurrentCulture.Name, Assembly.GetExecutingAssembly());
From the above code the application automatically detects the current culture of the system.Depending on the current culture I am setting the labels text on a form like this:-
private void button1_Click(object sender, EventArgs e)
{
SetText(this);
}
void SetText(Control ctl)
{
string text = rm.GetString(ctl.Name);
if (text != null)
ctl.Text = text;
foreach (Control ctl1 in ctl.Controls)
{
SetText(ctl1);
}
}
I am trying to find out a way by which my application set the Labels text itself when ever the system language changes. I mean i want to get rid of SetText() method written above.Is there any way by which I don't have to write any method like SetText() for setting all my controls text.If any one has any idea then please let me know.
Thanks.
|
|
|
|
|
Hi,
How to disable/remove "Delete-Key" on dataGridView?
because whenever i click on Row and then when I click press "Delete-Key" so row deletes.
kindly let me know that How can I stop this?
Thanks in Advance
(Riaz)
|
|
|
|
|
Set AllowUserToDeleteRows property to False.
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
|
Hi all,
this is not a clear C# problem, but the program is in C# and can't find a better place to ask.
So, the application have to maintain some documents, every user logging in must see and edit any of documents. My problem is: where to store these files? Until XP we used Program files\AppDir\Docs folder, but in Vista this not works. User's personal folders can't be used either. Please help with a good ideea/information
Thanks
|
|
|
|
|
Hi!
System.Environment.SpecialFolder.CommonApplicationData (or rather a subdirectory thereof) is the right folder for you.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
You could always use the IsolatedStorage classes.
|
|
|
|
|
We have just run into this same issue. We are now storing the docs under All Users\Application Data. This works for Win2000, XP, 2003 and Vista.
Under Vista, this is redirected through a junction to the folder c:\ProgramData.
If you want backward compatibility, use the All Users\Application Data path, otherwise, you could use the ProgramData path.
David
|
|
|
|
|
The following program reads from a text file containing numeric data stored in columns separated by one blank space. Write the code and compile it on your computer. Create a text file called myfile.txt containing a few columns (3?5 for example) of numeric data (real numbers) and test the program.
#include <stdio.h>
int main(void)
{
FILE *fp;
double val;
char ch;
fp = fopen("myfile.txt","r");
do{
fscanf( fp, "%lf", &val );
ch = getc(fp);
printf(" %lf",val);
if ( ch=='\n' || ch==EOF )
printf("\n");
} while ( ch != EOF );
fclose(fp);
return 0;
}
Modify the code so that the program additionally creates a new text file where it stores only the integer part (discard the factionary part) of the real numbers stored in myfile.txt. The new file should write data in the same format (3?5 with columns separated by space) as the original file. Include statements to check if the file was opened and closed successfully.
ad
|
|
|
|
|
Are you aware that:
- this is the C# (not the C/C++) formum
- we don't tend to make others homework for them
- you didn't even give a qustion
So this looks like:
- you are so lazy with your homework that you can't even be bothered to type a question
- and you don't even took you time to find the right forum
Conclusion:
I won't help either
|
|
|
|
|
Hi code-lovers
i want my programs as users can update their programs -i developed- from web, like "windows update"
how could i do?
|
|
|
|
|
Build > Publish %Your Project Name%
If you publish it to web, the program at client desktop will auto check the version number and update from the source url.
|
|
|
|
|
How to load treeview control from database using backgroundworker class.
|
|
|
|
|
What do you have already?
And please don't start a new thread for the same question every hour, that's considered rude.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Add a "DoWork" event to the backgroundWorker
fire backgroundWorker.RunSync(DataSet);
just paste the code in backgroundWorker_DoWork is fine
|
|
|
|
|
Hello experts,
I have a combo box with 26 items. Say A....Z.
I have another string that holds the item to match
I write following code..but it is not working why...?
strItemToMatch="C";
boolean isFound=false;
if (ComboBox1.Items.Contains(strItemToMatch.ToString()))
isFound=True;
else
isFound=False;
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Change
if (ComboBox1.Items.Contains(strItemToMatch.ToString()))
to
if (ComboBox1.Items.ToString().ToUpper().Contains(strItemToMatch.ToString().ToUpper()))
Hope it helps
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
I write this
if (Convert.ToBoolean(cmbSubItem.Items.ToString().ToUpper().Trim().Contains(itemlist[0].ToString().ToUpper().Trim())))
But this is also not working...
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|