|
Maybe grid's CellValueChanged event - in the event arguments you get the index of the edited row and column index as well..
it's called when the value is commited ex. when the editmode is set to 'doubleclick or f2' [entar] commits value change.
also when you use Convert.To... you don't have to use ToString() on the converted object.
life is study!!!
|
|
|
|
|
I want to know how to create a simple program that can print data using PRINTER CLASSES(if any) of C#?..
|
|
|
|
|
I am not clear about ‘Printer Classes’, however printing can be done using PrintDocument and Print Preview control.
In case if you need to access printer settings you may do so by accessing System.Drawing.Printing.PrinterSettings class items.
-Dave.
------------------------------------
http://www.componentone.com
------------------------------------
|
|
|
|
|
hmmm.. interesting... i'm trying to create my own text editor and should have the print feature.. am guessing maybe someone has already coded it so that i could just refer to the code. any tutorials or resources you have that could help?
|
|
|
|
|
hi,
i design a application that opens a form from other form, i use the ".showdialog" ".show" methods that works fine.
but a also want to close the first form when the second form loads, but i can´t manage to do that.
when i trie to do that i shutdown the all application or something else!!!
thanks!!!
|
|
|
|
|
The logical thing to do here is to make both forms laid out on user controls, then show them both in the one form.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
You may hide the first form (Closing your start up form will close the application).
Also code will stop executing at the call ".ShowDialog()", and will only continue after the user has closed the second form.
|
|
|
|
|
Hi,
How can i trigger an event when the user presses the cancel button [X] on the title bar? i want the application to perform a final task before it goes off!
|
|
|
|
|
You mean the Form's Closing event?
|
|
|
|
|
it´s to manage a login/logout process!
I prefer that the user uses the logout button, but sometimes the user shotdown the application or it goes down.
I already have a store procedure for all that but, like i said, sometimes i can´t get logout info.
yes, a form closing or application closing event i think!
|
|
|
|
|
Form.FormClosing
and maybe FormClosingEventArgs.CloseReason
|
|
|
|
|
nelsonpaixao wrote: or it goes down
There's nothing you can do about a system crash or the user terminating the app via Task Manager.
I use a FormClosing event handler to do cleanup like that.
The handler for a Close button simply calls this.Close()
|
|
|
|
|
Then have the FormClosing handler call the Logout handler.
|
|
|
|
|
Hi,
how can i set the color for the title bar? i can´t change it, it´s always blue!
the tagcontrol too!!!
modified on Wednesday, July 9, 2008 9:00 PM
|
|
|
|
|
Hi,
either change Windows appearance/theme for the entire system,
or use a borderless Window and draw a fake border yourself.
|
|
|
|
|
I believe you need to make them owner drawn and draw them yourself.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
You can't change the color of the titlebar without changing aspects of the visual style of the system or creating a new layout on a borderless form. If you would like to customize (add buttons, etc to the titlebar) or alter the tabcontrol appearance, I will point you to two of my articles:
Add Transparent Menus and Windows Titlebar Buttons to your Application[^]
ToolStrip Custom Renderers[^]
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hey guys,
I been trying to update my Listbox Control from importerCollection with no luck(importerCollection -class derived from List<importer>) .
Everytime I update/add item to my list, the LoadImporters() Method runs.
The problem is that it doesn't update my Listbox Control,
I been trying to use the Listbox.Refresh Method which didn't really worked.
The Only thing which worked is creating a new instance of ImporterCollection and settings the
Listbox datasource to this new instance.
I don't see any reason creating a new instance of it everytime I want to update/add Item in my List, it suppose to get update automatically.
I also have another problem, I dont know how to set the Databindings to update automatically. I think this problem might be the solution for the first problem
I will glad to hear some solutions to my problems. Thank you very much!
ImporterCollection importerCollection = new ImporterCollection();
public FormManageImporters()
{
InitializeComponent();
LoadImporters();
SetDataset();
SetBindings();
}
private void LoadImporters()
{
importerCollection.FillImporters();
}
private void SetDataset()
{
listBoxImporters.DataSource = importerCollection;
listBoxImporters.ValueMember = "ImporterID";
listBoxImporters.DisplayMember = "ImporterName";
}
private void SetBindings()
{
textBoxPhone.DataBindings.Add("Text", importerCollection, "Phone");
textBoxAlternativePhone.DataBindings.Add("Text", importerCollection, "AlternativePhone");
textBoxCellularPhone.DataBindings.Add("Text", importerCollection, "CellularPhone");
textBoxFax.DataBindings.Add("Text", importerCollection, "Fax");
}
private void Importer_Changed(object sender, EventArgs e)
{
LoadImporters();
}
private void buttonAdd_Click(object sender, EventArgs e)
{
FormImporter formImporter = new FormImporter();
formImporter.ImporterChanged += new FormImporter.ImporterChangedEventHandler(Importer_Changed);
formImporter.Show();
}
|
|
|
|
|
It's seems like no one had the answer to my questions,so I found it alone.
I want to share the solution with some guys who might have the problem too.
There are 2 ways to solve this problem, I will share what I found on the web.
The first one is by using a BindingSource as datasource instead of using your main datasource.
In my situation, it was "importerCollection", everytime an item is changed in the list you call the "bindingSource.ResetBindings(true)" Method.
The second solution for this problem is by using BindingList<> instead of List<>,
which can tell automatically if an object in your list has changed.
|
|
|
|
|
Hi, i got this code to calculate the price when i tick the checkbox in my datagridview
double price = 0.0;
foreach (DataGridViewRow dgw in dataGridProduct.Rows)
{
DataGridViewCheckBoxCell datacell = dgw.Cells[0] as DataGridViewCheckBoxCell;
try
{
if ((bool)datacell.Value == true)
{
price += Convert.ToDouble(dgw.Cells[6].Value.ToString());
lblTotalPrice.Text = "Total Price : $ " + price;
}
}
catch (Exception exc)
{
}
}
When i tick the box, the price should add up, and when i untick the price will be minus.
I believe abit of my logic is wrong, can you help me with it?
|
|
|
|
|
Check the state of the checkbox and use the appropriate operator.
if(checkbox1.checked)
price += Convert.ToDouble(dgw.Cells[6].Value.ToString());
else
price -= Convert.ToDouble(dgw.Cells[6].Value.ToString());
Just because we can; does not mean we should.
|
|
|
|
|
What problem are you having?
One problem I can see is that you don't have any logic listed to do the price subtraction.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
You are missing code for when the checkbox is false. Look at the else clause that you have been shown...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
How do change the properties of tool in Form1 from other Form2?
|
|
|
|
|
Via a delegate, I guess.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|