|
when i dock my listbox to the left\right it doesn't take up all the left, and leaves a gap down (see image).
it wasn't like this before...so...any suggestions?
Screenshot from visual studio (2005)
|
|
|
|
|
i have the same result. I think it's normal
-------------------
You can go a long way with a smile. You can go a lot farther with a smile and a gun. (C) Al Capone
|
|
|
|
|
then it sucks =\
no way to fix it?
|
|
|
|
|
Under some circumstances a listbox tries to have a height corresponding to
an integral number of text lines (and fails at this when the hor scrollbar appears).
The best way to observe this is to load the listbox with a lot of text lines...
|
|
|
|
|
uhh, did you see the screenshot? cause..uhh..this doesn't seem to answer my question (or is it just me?)
|
|
|
|
|
yes
it answers the " and leaves a gap down " part.
|
|
|
|
|
Hello,
I'm working on a bank program for my C# course at the Uni. I have this "Save" button on my bank UI which saves everything on the form to a XML file called "Account_Data.xml"
My question is, how do you update records in the xml file, if there is an record in there already with the name Account ID.
This is the xml file format:
< ? xml version = " 1.0 " ? >
< Accounts >
< Account ID = " 123456 " >
< FirstName > Latheesan < / FirstName >
< SecondName > Kanes < / SecondName >
< Balance > 0 < / Balance >
< OverDraftLimit > 50 < / OverDraftLimit >
< FullAddress > My Address Here < / FullAddress >
< / Account >
< / Accounts >
Im very new to C# with XML, so im still getting used to this. I'd appreciate it if someone could point me in the right direction.
|
|
|
|
|
Hi. The XmlDocument class allows you to search and modify Xml nodes using the Document Object Model ( DOM ), which is a standard interface for working with XML. The language used to search XML is called XPath. The w3schools site is the best IMO for learning about any standard stuff like this, http://www.w3schools.com/xpath/[^] is the starting point for XPath. Basically you use SelectSingleNode or SelectNodes to find the node you want, then you can modify it, remove it, or insert a node just after it.
msdn.microsoft.com is the best place for info on the XmlDocument class.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi
i have two table :
t_books(bookID(PK),bookName) -> master
t_sessions(sessionID(PK),bookID(FK),sessionName) -> details
i wrote this code to show hirarical data in treeView :
SqlConnection con = new SqlConnection(Properties.Settings.Default.Database1ConnectionString);<br />
SqlCommand cmd = new SqlCommand();<br />
SqlDataAdapter adapter = new SqlDataAdapter();<br />
cmd.CommandText = "select * from t_books";<br />
cmd.Connection = con;<br />
adapter.SelectCommand = cmd;<br />
DataSet ds = new DataSet();<br />
<br />
SqlCommand cmd2 = new SqlCommand();<br />
SqlDataAdapter adapter2 = new SqlDataAdapter();<br />
cmd2.CommandText = "select * from t_sessions";<br />
cmd2.Connection = con;<br />
adapter2.SelectCommand = cmd2;<br />
<br />
adapter.Fill(ds, "t_books");<br />
adapter2.Fill(ds, "t_sessions");<br />
DataRelation dataRelation;<br />
DataColumn dc1 = ds.Tables["t_books"].Columns["bookID"];<br />
DataColumn dc2 = ds.Tables["t_sessions"].Columns["bookID"];<br />
dataRelation = new DataRelation("Relation1", dc1, dc2);<br />
ds.Relations.Add(dataRelation);<br />
<br />
TreeNode book;<br />
TreeNode session;<br />
<br />
foreach (DataRow row in ds.Tables["t_books"].Rows)<br />
{<br />
book = new TreeNode(string.Format("{0}", (string)row["bookName"]));<br />
book.Tag = row;<br />
<br />
ds.Tables["t_sessions"].DefaultView.RowFilter = "bookID="+ row["bookID"];<br />
foreach (DataRow sessionRow in ds.Tables["t_sessions"].Rows)<br />
{<br />
session = new TreeNode(string.Format("{0}", (int)sessionRow["bookID"]));<br />
session.Tag = sessionRow; <br />
book.Nodes.Add(session);<br />
}<br />
this.treeView1.Nodes.Add(book);<br />
}
but in runTime, My data in treeView don't filtered and in each node of books(master), show all of sessions(details) and not filter, how to solve my problem ?
|
|
|
|
|
I think this line
foreach (DataRow sessionRow in ds.Tables["t_sessions"].Rows)
is wrong, but as you didn't post this as a reply to last week's post where I guess I helped you get this far and I deleted the example program I had written, I now have to did through last weeks' messages to find out what it should be.
At any rate, you need to foreach across the DataView, not the Table.Rows
-- modified at 17:56 Sunday 13th May, 2007
Ah, the example, once I found it has
foreach ( System.Data.DataRowView petrow in ds.Tables [ "Pet" ].DefaultView )
|
|
|
|
|
Hi
I have trouble comparing two dates:
if (dateFrom.Value > dateTo.Value)
{
Console.WriteLine(dateFrom.ToString());
Console.WriteLine(dateTo.ToString());
MessageBox.Show("Start date must me before end date", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return;
}
This condition sometimes triggers, even if both dates are the same!
Console.WriteLine will output something like this:
System.Windows.Forms.DateTimePicker, Value: 12.05.2007 16:12:18
System.Windows.Forms.DateTimePicker, Value: 12.05.2007 16:12:18
Both controls are by default created with the same (default) value on the form, but the if-condition only sometimes tells me that dateFrom > dateTo.
What's going on here?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Maybe the difference is smaller than a second. Try to print out the Ticks property.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
From: 633145845616718750
To: 633145845616562500
Indeed. Why is that, even when dateFrom is created earlier than dateTo?
/edit:
Looks like Controls.Add() is called with dateTo first, then dateFrom next.
I rearranged them, I hope it's fixed now.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The Ticks property holds the actual raw value that represents the date. A DateTime object in .NET always contains a full date/time value, which includes fractional seconds. Depending on how you are initializing the variables, you are most likely hitting differences in a portion of the time smaller than what you are actually visibly seeing.
Try initializing them using the full constructor, which specifies the full date and time values, or setting one equal to the other.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Maybe they differs in milliseconds (or even ticks ). I suggest you to initialise a TimeSpan var with the difference of the two DateTimePicker values and then check the amount of the difference (for instance you may consider equivalent two dates having different hours).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I have the following code which is supposed to append two elements, each having string content, to the previous element. The problem is that only the second string is added to the xml file!
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(sFile);
XmlElement elem = xmlDoc.CreateElement("card");
XmlAttribute attr = xmlDoc.CreateAttribute("number");
attr.Value = iCardNo.ToString();
elem.Attributes.Append(attr);
elem.InnerXml = "<front></front>";
XmlText textNode = xmlDoc.CreateTextNode(sCardFront);
elem.FirstChild.AppendChild(textNode);
elem.InnerXml = "<back></back>";
textNode = xmlDoc.CreateTextNode(sCardBack);
elem.LastChild.AppendChild(textNode);
xmlDoc.DocumentElement.AppendChild(elem);
xmlDoc.Save(sFile);
Only the second element is appended!
Mark
|
|
|
|
|
Mark F. wrote: elem.InnerXml = "<back></back>";
This line overwrites all content of the element. To be consistent you should use CreateElement and AppendChild to add the front and back elements.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Ok it's working better. However, the card element has no closing element tag. The card element is
<card number="1" />
rather than
<card number="1">
</card>
Here's the code:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(sFile);
XmlElement rootElem = xmlDoc.CreateElement("card");
XmlAttribute attr = xmlDoc.CreateAttribute("number");
attr.Value = iNewIndex.ToString();
rootElem.Attributes.Append(attr);
xmlDoc.DocumentElement.AppendChild(rootElem);
XmlElement frontElem = xmlDoc.CreateElement("front");
XmlText text1 = xmlDoc.CreateTextNode(sCardFront);
xmlDoc.DocumentElement.AppendChild(frontElem);
xmlDoc.DocumentElement.LastChild.AppendChild(text1);
XmlElement backElem = xmlDoc.CreateElement("back");
XmlText text2 = xmlDoc.CreateTextNode(sCardBack);
xmlDoc.DocumentElement.AppendChild(backElem);
xmlDoc.DocumentElement.LastChild.AppendChild(text2);
xmlDoc.Save(sFile);
Thanks for the help!
Mark
|
|
|
|
|
Mark F. wrote: Ok it's working better. However, the card element has no closing element tag. The card element is
<card number="1" />
rather than
<card number="1">
</card>
This is perfectly valid in XML.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
That's true. But I would like the two innner tags to be wrapped in the card tags.
<card number="1">
<front>Some content</front>
<back>Some content</back>
</card>
Mark
|
|
|
|
|
Mark F. wrote: XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(sFile);
XmlElement rootElem = xmlDoc.CreateElement("card");
XmlAttribute attr = xmlDoc.CreateAttribute("number");
attr.Value = iNewIndex.ToString();
rootElem.Attributes.Append(attr);
xmlDoc.DocumentElement.AppendChild(rootElem); <-here you append rootElem to doc. node
XmlElement frontElem = xmlDoc.CreateElement("front");
XmlText text1 = xmlDoc.CreateTextNode(sCardFront);
xmlDoc.DocumentElement.AppendChild(frontElem); <- here you append front elem to doc. node as well! It should be rootElem.AppendChild(frontElem);
xmlDoc.DocumentElement.LastChild.AppendChild(text1);
XmlElement backElem = xmlDoc.CreateElement("back");
XmlText text2 = xmlDoc.CreateTextNode(sCardBack);
xmlDoc.DocumentElement.AppendChild(backElem); <- should be rootElem.AppendChild(backElem);
xmlDoc.DocumentElement.LastChild.AppendChild(text2);
xmlDoc.Save(sFile);
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Hello, I've got a problem, how to create synchronized RIchTextBoxes (Controls, not Forms) in C#, .NET 3.0. There are total 3 rtboxes and I want them to be synchronized together. The problem is, that ther's no scroll event raised by the RichTextBox, the only thing, I've found, is
ExtentHeight, ExtentWidth, HorizontalOffset, VerticalOffset, ViewportHeight, ViewportWidth.
I've also tried to create an extra Scrollbar and use it for controlling the rtboxes, but it doesn't worked, somehow.
Please help, thank's a lot
|
|
|
|
|
Hi all,
i am using Click once to deploy my windows application
here i am manually updating my solution, by using the code in the buttion click.
but i am uable to excute my software please help me...
the code that i used is
if (ApplicationDeployment.IsNetworkDeployed)
{
// Hold a reference to the current deployment
ApplicationDeployment currentDeploy =
ApplicationDeployment.CurrentDeployment;
// Check to see if an update is available on the server
if (currentDeploy.CheckForUpdate())
{
// One is available, go get it
currentDeploy.Update();
// Make sure you save application state here
DialogResult dr = MessageBox.Show(
"Update downloaded, restart application?",
"Application Update",MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
Application.Restart();
}
}
}
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
Hi, do you know what exactly do we need to install first to allow msagent characters speak?? and what files exactly are needed for them to take commands?? I have a little application that uses them and every time I just install everything related to ms agents to run it and hence not sure what files are being actually used
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi!
I want to do the following:
All seconds I want to delete an existing picture and do Graphics.DrawImage with a new picture. So my problem is: I can't delet the old picture from Graphics and so no changes are shown on my screen.
Does anybody know help?
thanks
Josi
|
|
|
|