|
Hi,
I'm using a LookUpEdit in my XtraGrid, which I connect to a datasource at
runtime. When I select a value from the LookUpEdit, everythings fine, the
selected value is shown in the cell, but when this cell loses its focus, the
cell becomes empty.
When I use a ComboBox which I manually fill at runtime, I do not have this
problem.
Any Ideas on solving this problem? Please help me!
Thanks.
NPS.
|
|
|
|
|
Have you set the Properties.DisplayMember & Properties.ValueMember?
|
|
|
|
|
|
Hmm, well that's pretty much all I do.
1) Set the Properties.DataSource
2) Set the Properties.ValueMember
3) Set the Properties.DisplayMember
4) Set up the Properties.Columns
If the data is missing after you move away, is the lookup dataset being closed?
|
|
|
|
|
How can I get the title from a program that is active?
I will develop a program that logs every program that a user have used. For example if someone opens notepad I want to retrieve "Untitled - Notepad"
I'm using .NET 2.0
Thanks!
|
|
|
|
|
You need to use the Windows API to lookup that sort of information, and get an IntPtr to the window
perhaps this[^] will help
kind regards,
g00fy
|
|
|
|
|
<br />
<br />
public class Foo<br />
{<br />
<br />
[DllImport("user32.dll")]<br />
public static extern IntPtr GetForegroundWindow();<br />
<br />
[DllImport("user32.dll", CharSet=CharSet.Auto)]<br />
public static extern uint GetWindowText(IntPtr hwnd, StringBuilder text, int maxCount);<br />
<br />
public string GetActiveWindowText()<br />
{<br />
IntPtr hwnd = GetForegrondWindow();<br />
<br />
StringBuilder builder = new StringBuilder(255);<br />
GetWindowText(hwnd, builder, 255);<br />
return builder.ToString();<br />
}<br />
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
|
That doesn't get the result he wants. To use that method you need a process instance. He wants to get the title of the window the user is interacting with. For that he needs some equivalent of GetForegroundWindow().
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
Hi,
I am trying to change the selection of a combobox but am unable to do so, or that is to say I am unable to figure out what event I need to use or how to do it properly...perhaps a more detailed explanation will suffice.
I have some items in my combobox like:
Item A (1)
Item B (2)
Item C (43)
Item D (57)
When the user selects one I want to place the number that is in parens in combobox.Text.
The problem is I can't seem to figure out how to do this. I used the event SelectedValueChanged but as soon as the event is done, the picked value goes in. Here is the code:
private void _cbo_SelectedValueChanged(object sender, System.EventArgs e)
{
int index1 = _cbo.Text.IndexOf("(") + 1;
int index2 = _cbo.Text.IndexOf(")");
_cbo.Text = _cbo.Text.Substring(index1, index2 - index1);
}
The code works I see the text in the combobox but then it is replaced with what the user selected again.
Any help would be greatly appreciated.
Sean
|
|
|
|
|
you may also need to set one of
SelectedText
SelectedItem
|
|
|
|
|
I have tried messing with those and get some very odd results. I am missing something, I must have the wrong event. Any other ideas?
Sean
|
|
|
|
|
Is there a way to "hide" some of the printers that are normally seen in a PrintDialog? I have an application that's required to show only the printers (not faxes or imaging drivers) when printing or only faxes when faxing.
cobra2005
|
|
|
|
|
Only if you create your own PrintDialog and enumerate the installed printers yourself. The system and .NET PrintDialogs will show all installed printers, no matter what type they are.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello ...
I need to extract the first frame of a given video and convert it to an image .
i'm developing an editor for HTML using C#.
i want to use it when a webbrowser fails to download a video
as follows
|
|
|
|
|
Hi
I am dumping a table's data into xml document using C#. I am getting the data but the problem is that "<" character appears as "& l t ;" (I inserted the empty space intentionally).
Similarly, there are other characters appearing incorrectly.
What should I do to make it appear correctly like "<" . Please advise.
Thanks
Pankaj
-- modified at 17:14 Friday 16th December, 2005
|
|
|
|
|
pankazmittal wrote: that "<" character appears as "<".
pankazmittal wrote: it appear correctly like "<" .
|
|
|
|
|
its actually
"<" character appears as "& l t ;" (remove empty spaces )
|
|
|
|
|
you must be outputing the XML yourself.
System.Xml.XmlDocument
|
|
|
|
|
Where are they appearing incorrectly? If you mean that they are stored that way in the xml file, it's not incorrect, they have to be stored that way.
---
b { font-weight: normal; }
|
|
|
|
|
If I understand you correctly, you have a table like the following:
<table>
<tr>
<td>
Some table data.
</td>
</tr>
</table> and when you put it in the XML document, you get:
<myXml>
</tableData>
<table>
<tr>
<td>
Some table data.
</td>
</tr>
</table>
</tableData>
</myXml> If so, then when you dump it into the XML document, your code (intentionally or not) has replaced the predefined XML entities with their ENTITY counterparts. Five predefined entities exist:- > becomes >
- < becomes <
- " becomes "
- ' becomes '
- & becomes &
Perhaps you can post how you put the table data into the XML document and we can help you avoid these automatic conversions.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thanks for understanding. I am simply pulling the data from table and access it using dataset "dsCC" in following code.
Here is the code I am using:
--------------------Code Starts here-------------------------------
if (dsCC.Tables.Count > 0)
{
dvCC = dsCC.Tables[0].DefaultView ;
if (dvCC.Count > 0)
{
xDoc = new XmlDocument();
XmlElement xElmntRoot;
XmlElement xElmntAccount;
xElmntRoot = xDoc.CreateElement("root");
xDoc.AppendChild(xElmntRoot);
InsertTextNode(xDoc, xElmntRoot, dvCC.Table.Columns[0].ColumnName, Convert.ToString(dvCC[0][0]));
xElmntAccount = xDoc.CreateElement("Accounts"); // xElmntRoot. //xElmntRoot.AppendChild("Accounts");
xElmntRoot.AppendChild(xElmntAccount);
for (int nRowCounter = 0; nRowCounter <= dvCC.Count - 1; nRowCounter++)
{
for (int nColCounter = 1; nColCounter <= dvCC.Table.Columns.Count - 1; nColCounter++)
{
InsertTextNode(xDoc, xElmntAccount, dvCC.Table.Columns[nColCounter].ColumnName, Convert.ToString(dvCC[nRowCounter][nColCounter]));
}
}
sDestinationFileWithPath = HttpContext.Current.Request.ServerVariables["APPL_PHYSICAL_PATH"] + @"ClientConfig.xml";
xDoc.Save(sDestinationFileWithPath);
}
}
private XmlElement InsertTextNode(XmlDocument xDoc,XmlNode xNode ,string strTag, string strText)
{
// Insert a text node a child of xNode.
// Set the tag to be strTag, and the text to be strText. return a pointer to the new node.
XmlNode xNodeTemp;
xNodeTemp = xDoc.CreateElement(strTag);
xNodeTemp.AppendChild(xDoc.CreateTextNode(strText));
xNode.AppendChild(xNodeTemp);
return (XmlElement) (xNodeTemp);
}
--------------------Code Ends-------------------------------
When I open the xml file, the data looks like
<EncryptionType>&lt;![CDATA[etPublicKey]]&gt;</EncryptionType>
-----------------------------
What I want is
<EncryptionType><![CDATA[etPublicKey]]></EncryptionType>
-----------------------------
I hope I am clear now Thanks
Pankaj
|
|
|
|
|
In InsertTextNode(...) , try replacing xNodeTemp.AppendChild(xDoc.CreateTextNode(strText)); with xNodeTemp.AppendChild(xDoc.CreateCDataSection(strText)); . Maybe that'll work correctly for you.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Playing with the ListView to try to get colored backgrounds.
ListViewItem lviGrossMargin = new ListViewItem(strListViewItem);
lvOptions.Items.Add(lviGrossMargin);
lviGrossMargin.SubItems[0].BackColor = System.Drawing.Color.Wheat;
lviGrossMargin.SubItems[1].BackColor = System.Drawing.Color.SpringGreen;
lviGrossMargin.SubItems[2].BackColor = System.Drawing.Color.YellowGreen; If I set lvOptions.Background, I color the entire background the identified color. But coding as above, I get the same result. Setting SubItems[0] to Wheat sets all SubItems. Setting SubItems[1] or [2] does nothing.
Playing with the SubItems[n].Text does apply the expected text in each column. If I play with ForeColor, same as BackColor occurs. [0] is recognized and applies it to all SubItems. It is only the colors that don't seem to work.
Is there a step I skipped that has to be done before manipulating colors or is it a feature that doesn't work correctly in VS Studio 2003?
|
|
|
|
|