|
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.
|
|
|
|
|
You can use a get if your initializing Form2 from Form1, and using Form2 as a Dialog.
For example:
private string _PropertyValue;
public string PropertyValue
{
get{return _PropertyValue;}
}
private void ShowForm2()
{
Form2 f2 = new Form2();
if(f2.DialogResult = DialogResult.OK)
{
property.value = f2.PropertyValue;
}
}
You would need to set up Form2 with dialog returning properties. Be wary that this answer might not be appropriate for your case.
|
|
|
|
|
use "passing data between form" in search textbox. you have several articles!
good luck
|
|
|
|
|
Hi, how do i empty every object inside my hashtable
|
|
|
|
|
I would guess that you can Clear the Keys property. Assuming the hashtable doesn't have an overall Clear method, like the other containers do.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hashtable ht = new Hashtable();
ht.Clear();
Try just typing your variable plus .
ht.
and look through the options. Its usually in front of you.
Hogan
|
|
|
|
|
hi,
let suppose ,there are 10 combobox in a windows application form ,i want set the selected.index= 0 of all combobox by foreach loop.....i have try but fail
|
|
|
|
|
foreach(Control c in Controls)
{
ComboBox cb = c as ComboBox;
if (cb != null)
cb.SelectedIndex = 0;
}
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
hi,
when i use youe coding without if(cb!=null) then an error occur......why?
i confuse because combobox collections has some data....
|
|
|
|
|
You're selecting all the controls, but not all of them will be a combobox. With the check for null, you're making sure that the object you just MADE a combobox, was really a combobox to begin with
|
|
|
|
|
but i declare first ... ComboBox cmb = c as ComboBox;.then why we confirm either it is combobox or not
|
|
|
|
|
foreach(Control c in Controls)
{
ComboBox cb = c as ComboBox;
if (cb != null)
cb.SelectedIndex = 0;
}
this loops through ALL the controls on the current form, that's buttons, checkboxs, textboxes etc. There are a lot of controls on a form. So, as you're looping through, if you try and treat an object that is NOT a checkbox like a checkbox, it will error. Soooooo.... you test to see if the conversion to ComboBox worked. You can't easily select JUST ComboBoxes from a form, you have to go through the controls.
|
|
|
|
|
Thanks.....important thing is "ComboBox cb = c as ComboBox;" if c is not combobox then cb.SelectedIndex = 0; would be fail.........
thanks again....
|
|
|
|
|
|
"public void DisplayMessage(Object myReactor, MeltdownEventArgs myMEA)
{
//FormReactor FR = new FormReactor();
String message = myMEA.Message;
delegateReactorMessage(FR.listBoxReactor, message);
}"
First, your delegate doesn't need to conform to the object/eventargs model, it can have any signature.
Second, it looks like you're trying to pass the listbox to the delegate. Why ? That misses the whole point. The point is, your delegate method should fire in the scope of the listbox, and the code to work with the listbox should run locally. If you're going to pass the listbox, the code could be anywhere, so why use delegates ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|