|
plz see this Q
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&select=1569433&df=100&msg=1569433
Palestine
|
|
|
|
|
hello, I got this exception on the first line of this code in the designer:
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(3, 3);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(222, 94);
Basically i just added a picturebox to contain a jpg image. this form is common to all the applications and they work fine with the others. but the app im working on throw me back the error message. Im using VS2005 CF .net 2.0 so do the other app (which are written by me too). So i don't get it. why the others are fine but this later doesn't work.
Any suggestion?
Donkaiser
|
|
|
|
|
I have been working on a large project in VS2005, and I have come to need the System.Drawing.Point struct, and instead of having loads of stuff in the System.Drawing namespace I only have:
System.Drawing.Dimension<br />
System.Drawing.Dimension2D
I have been trying to work out what has switched this off but cannot fathom what it could be. Could some kind soul point (sorry for the pun) me in the direction of how to resolve this iritating issue, please.
Thanks.
|
|
|
|
|
I feel so stupid. As soon as I had logged this message I noticed that my project References was very low. I have now added a reference to the System.Drawing namespace and we are back in business. God knows why this became un-referenced!
|
|
|
|
|
I am optimizing application written in C#. It is apparently exceeding the user objects limit in XP.
Now I want to trace where all these user object are being created by the application.
Is there any tool available which would serve the purpose?
Or any other way?
Every bit counts
ADD
|
|
|
|
|
|
Hy,
Can anyone tell me a way to supress the paint event in Windows Forms?
I have on my form several controls and I don't want them to be redrawn when I maximize the form (for example).
Thanks
Do your best to be the best
|
|
|
|
|
Any time the state of the window changes (maximize, minimize, move a mouse, drag a form across....) it invalidates the view since that view is no longer valid. If you suppressed the Paint event then your controls would disappear from the view by the vary nature of Invalidate(). I'm curious as to the logic behind not redrawing the controls...perhaps there is another route that keeps your controls visible.
|
|
|
|
|
If you want to prevent the Paint event from firing (which is a very odd thing to do, btw), then you can override OnPaint and do not call the base implementation. The base impl fires the event.
:josh:
My WPF Blog[^]
|
|
|
|
|
Hi @all,
i have a big problem. I want to read an attribute from the following XML-File:
-------------
<main>
<equations>
<rule name = "equation1"
calc = "D=A+B+3*C"></rule>
<rule name = "equation2"
calc = "E=A*B+C*D"></rule>
<rule name = "equation3"
calc = "C=B/A"></rule>
</equations>
<values>
<rule name = "equation1">
<Source obj = "12.3"
field = "A"></Source>
<Source obj = "1"
field = "B"></Source>
<Source obj = "23"
field = "C"></Source>
</rule>
<rule name = "equation2">
<Source obj = "1"
field = "A"></Source>
<Source obj = "1"
field = "B"></Source>
<Source obj = "7"
field = "C"></Source>
<Source obj = "6"
field = "D"></Source>
</rule>
<rule name = "equation3">
<Source obj = "12.3"
field = "A"></Source>
<Source obj = "1"
field = "B"></Source>
</rule>
</values>
</main>
---------------
So tried to get the "equation1" from the first rule segment in value with the following code:
-----------------
XPathDocument document = new XPathDocument("test.xml");
XPathNavigator navigator = document.CreateNavigator();
XPathNodeIterator name = navigator.Select("main/values/rule[0]");
string i = name.Current.GetAttribute("name", string.empty);
-----------------
or:
-----------------
XPathNodeIterator name =navigator.Select("main/values/rule[0]/@name");
if (name.MoveNext())
{
string i = name.Current.Value;
}
-----------------
Nothing works! I'am getting an empty string (""). If I debug I see name->Current->HasAttribute = false.
I dont know what I can do. Can you help me please?
Thank you very much!
(sorry for my english, my native language is not english
-- modified at 9:39 Monday 10th July, 2006
|
|
|
|
|
Hy,
When I'm working with XML files I always use XmlDocument. Try this and see if it works:
XmlDocument document = new XmlDocument();
document.Load("file.xml");
XmlNode node = document.DocumentElement.ChildNodes[0];
Then use the node.Attributes[ <index or="" name="">] to get the attribute. If you want to do this for every node there is an XmlNodeList class which can be used.
Do your best to be the best
|
|
|
|
|
You can use something like this:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("test.xml");
XmlNode equationsNode = xmlDoc.ChildNodes[0].ChildNodes[0] as XmlNode;
XmlNode valueNode = xmlDoc.ChildNodes[0].ChildNodes[1] as XmlNode;
foreach(XmlNode xmlNode in equationsNode)
{
XmlAttribute nameAttr = xmlNode.Attributes["name"];
XmlAttribute calcAttr = xmlNode.Attributes["calc"];
Console.WriteLine(nameAttr.Value + " " + calcAttr.Value);
}
foreach(XmlNode xmlNode in valueNode)
{
foreach(XmlNode sourceNode in xmlNode.ChildNodes)
{
XmlAttribute objAttr = sourceNode.Attributes["obj"];
XmlAttribute fieldAttr = sourceNode.Attributes["field"];
Console.WriteLine(objAttr.Value + " " + fieldAttr.Value);
}
}
|
|
|
|
|
Thank you very very much Karkster and stancrm!!! This will help me much more!
Thanks again!
|
|
|
|
|
i have listBox with multi coulm
how can add control to item 1 in col 2 ??
control as comboBox
Palestine
|
|
|
|
|
A listbox is not multi-collumn. So you either have a custom control or you have a DataGridView and the answer would greatly differ based on each type of control.
United States
|
|
|
|
|
He probably means a ListView. If that's the case, he's SOL.
:josh:
My WPF Blog[^]
|
|
|
|
|
ListBox can be multicolumn (ListBox.MultiColumn = true) but these columns are not the same as ListView columns (in Details mode) or Grid columns. Every item in a ListBox can contain only a single value and there is no column2 of the item1. To understand how it works just create a ListBox with size 300x300, fill it with 100 items and set MultiColumn = true. Then set MultiColumn = false. And you will see difference between ListBox columns and Grid columns.
The answer is:
1. You can not add control to the column2 of the item1 because there is no column2 for the item1 in ListBox control.
2. You can not even add control to the item1's column1 because ListBox control doesn't allow it.
So if you want to add custom controls to the some list don't use ListBox control.
|
|
|
|
|
hi all,
this query :
string query = "insert into KiralamaBilgisi(Kasa,DovizCinsi,GunlukKira,ToplamKira,KiraBaslangic,KiraBitis,KiraSuresi,COSaati,KaydiYapan) values(" + Convert.ToInt32(txtOdaNo.Text) + ",'" + txtDovizCin.Text + "'," + Convert.ToInt32(txtGunlukKBedel.Text) + "," + Convert.ToDouble(txtToplamKBedel.Text) + ",#" + Convert.ToDateTime(txtKiraBaslangic.Text).ToShortDateString() + "#,#" + Convert.ToDateTime(txtKiraBitis.Text).ToShortDateString() + "#," + Convert.ToInt32(txtKiraSuresi.Text) + ",'" + cmbCOSaati.Text + "','" + lblUserName.Text + "')";
doesnt return any error if my regional and language options is English...
but it returns: Number of query values and destination fields are not the same
whats wrong with date values? what should i do so as to make my program work both for english and turkish computers ???
thanks in advance, bye.
|
|
|
|
|
Mehmet Fatih Akbulut wrote: values(" + Convert.ToInt32(txtOdaNo.Text) + ",
This parameter in values will be treated as a single string. If you actually debugged your code and looked at your query variable you would answer your own question in 2 seconds.
You probably want :
values("'" + Convert.ToInt32(txtOdaNo.Text) + "'", ...
|
|
|
|
|
Hi
I want to know how to change the skin of a Windows Form. How can I change replace the MaximizeBox of a Windows Form as example. I don't want to use third party components. I just want to write my own stuff. But yet, i don't know how. Can anyone shortly explain how to make my own Windows Form or to replace the header with a grphic..
Thx
|
|
|
|
|
Try to see this example:
http://www.codeproject.com/cs/miscctrl/GoogleTalkWindowsForm.asp
|
|
|
|
|
|
Hy,
To create a skin for a windows form i use images. Set an images as the background image of your form and also set the border style of the form to None. The image I use has already drawn on it a maximize box and other buttons. I only put a label on top of these buttons and handle the click event. Using this method you can place buttons everywhere on the form.
Hope my suggestion helps
Do your best to be the best
|
|
|
|
|
Hi!
I have a ListView with two date-columns, "started", and "ended". I want them all to be sorted on the "started" column, but I want all the rows without an "ended" value separated and displayed before rows with "ended" value, like this:
Started Ended
050101
051110
051231
050101 061231
050910 061231
Ive done an ListViewItemSorter thingie, but I can't seem to make it sort with two separate columns:
class ListViewSortering : IComparer <br />
{<br />
private int col;<br />
public ListViewSortering() <br />
{<br />
col=0;<br />
}<br />
public ListViewSortering(int column) <br />
{<br />
col=column;<br />
}<br />
public int Compare(object x, object y) <br />
{<br />
return -String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text);<br />
}<br />
}
And the call:
this.wmLvInsatser.Sorting = SortOrder.None;<br />
this.wmLvInsatser.ListViewItemSorter = new ListViewSortering(1);<br />
<br />
this.wmLvInsatser.Sort();
Can anyone point me in the right direction?
-- modified at 7:27 Monday 10th July, 2006
|
|
|
|
|
Hi,
the following modification should work:
class ListViewSortering : IComparer
{
private int colStart;
private int colEnd;
public ListViewSortering()
{
colStart=0;
colEnd=0;
}
public ListViewSortering(int columnStart, int columnEnd)
{
colStart=columnStart;
colEnd=columnEnd;
}
public int Compare(object x, object y)
{
ListViewItem lvi1 = (ListViewItem)x;
ListViewItem lvi2 = (ListViewItem)y;
string start1 = lvi1.SubItems[colStart].Text;
string end1 = lvi1.SubItems[colEnd].Text;
string start2 = lvi2.SubItems[colStart].Text;
string end2 = lvi2.SubItems[colEnd].Text;
if (end1.Length == 0 && end2.Length > 0)
return -1;
if (end1.Length > 0 && end.Length == 0)
return 1;
return -String.Compare(start1, start2);
}
}
So basically when only one of both items doesn't have an end date you'll return a special result value. In all other cases the normal comparison is done.
Robert
|
|
|
|