|
That's pretty slick. Thanks Heath
|
|
|
|
|
Greets all,
How do you get a newline in Text property of a Label control?
I've tried \n and \r\n but neither work. Any suggestions?
.:. Keno .:.
|
|
|
|
|
You would have to owner-draw (i.e., override OnPaint ) to accomplish such a thing. A common work-around is to use a multi-line TextBox with ReadOnly set to true and no border. Then you can use Environment.NewLine (portable code should never hard-code carriage returns and/or line feeds).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath!
I wonder why this functionality isn't available though, If I remeber correctly this was possible in VC wasn't it?
.:. Keno .:.
|
|
|
|
|
Hi, Im makin a custom listviiew with filters in columnheaders interop with the windows dlls.
I have studing this capabilities and now understand how it works and where found documetation about Messages, etc.
But I need to capture the ColumnFilter Keyup or keypress event, to add some tasks.
I foud only this notification codes:
HDN_FILTERCHANGE (Like textchange)
HDN_FILTERBTNCLICK (Button click)
HDM_EDITFILTER (Start editing)
HDM_CLEARFILTER (Clears the filter)
How can I captrure key related events of column header filter, if it is possble?
I need to make my filter task whe the user hit the enter key on columnheader filter, and pass the focus throw the filters with thhe tab key. (my users need it )
Thank you!
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
The child control (the Header control) notification messages are passed to the parent - the ListView . In the override to ListView.WndProc you'll typically receive WM_NOTIFY -style messages (like in the case of the notification (HDN_* ) messages you mentioned). The NMHDR contains the HWND (an IntPtr in .NET) of the control that sent it. You can compare this with the header's HWND , which you can get by send LVM_GETHEADER to your ListView.Handle (the List-View's HWND ). This is all documented in the Platform SDK for the common controls and some experience with handling controls natively would be helpful.
Also, this has already been done and I suggest you read an article about it here on CodeProject: ListViewFilter Control for .NET[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi,
I would like to see if someone can give me an idea/hint on now to convert fish eye (panoramic view images, you can take them with panorama add-on to camera and they look round) images into "flat" long in width images?
the idea is that I am trying to convert fish eye image into a flat one to view on computer... the images are taken with digital camera.
thanks...
I am ready to give a better explanation to what I am trying to figure if one above does not sound clear.
|
|
|
|
|
I am using the VS.Net 2005 alpha and I am getting a strange exception.
When I try to use the Axiom graphics library, it crashes when it tries to load the Win32InputReader class.
After some commenting, I found that the exception does not happen when I comment out the line "private MouseState mouseState;". MouseState is a DirectX type. I am using the Summer 2003 version of DirectX. It compiles fine, but stops when it tries to load that type.
What could be causing this? Compiles fine...
|
|
|
|
|
You have broken something in your constructor or being called from you constructor. Never let exceptions be thrown from a constructor. I suggest you delay some logic.
Also look at the warnings, you are likely hiding a variable in the base class.
|
|
|
|
|
I've commented out the contents of every function and it still happens. And the class does not have a base class.
|
|
|
|
|
I am hosting a WebBrowser control, and have a reference to the association document property (IHTMLDocument2 interface). Per Microsoft's guidelines, I have attached events as follows:
private void AttachListeners(IHTMLDocument2 Document) {
HTMLDocumentEvents2_Event iEvent = (HTMLDocumentEvents2_Event)Document;
iEvent.onmouseover += new HTMLDocumentEvents2_onmouseoverEventHandler(Element_onmouseover);
iEvent.onmouseout += new HTMLDocumentEvents2_onmouseoutEventHandler(Element_onmouseout);
}
I have another method, to remove the event listeners:
private void DetachListeners(IHTMLDocument2 Document) {
HTMLDocumentEvents2_Event iEvent = (HTMLDocumentEvents2_Event)Document;
iEvent.onmouseover -= new HTMLDocumentEvents2_onmouseoverEventHandler(Element_onmouseover);
iEvent.onmouseout -= new HTMLDocumentEvents2_onmouseoutEventHandler(Element_onmouseout);
}
My problem is that when I remove the listeners, it actually causes them to fire twice! If I try to call DetachListeners a second time, I get an error "object reference not set to an instance of an object" (I would expect some sort of error because I'm theoretically removing an event that has already been removed).
My guess is that there is a bug here in the interop stuff, where the "-=" operator is removing the event from the .net view of the world but adding it again in the COM level.
Anyone had this problem before, or know where to look?
Anthony King
|
|
|
|
|
Hi, I've already used a dll this way:
[DllImport("inpout32.dll", EntryPoint="Inp32")]
public static extern int Inbyte(int address);
And it works fine.
Now it looks like this DLL has been programmed in C or is a global function in C++. But now I want to use a DLL I compiled myself, but this DLL is programmed in C++ and I don't know how to import the functions since they are members of classes. How can I do it?
And is there a way to view the contents of a DLL file other than including it in the solution's references?
Thanks a lot!
|
|
|
|
|
|
I have the following SOAP data (which I have no control over):
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Logon xmlns="http://www.domain.com/EP/">
<userId>int</userId>
<strPassword>string</strPassword>
<strSessionId>string</strSessionId>
</Logon>
</soap:Body>
</soap:Envelope>
I need to be able to parse through this to extract the childnode values of <Logon>, and place these into a sorted list. Simple I thought, but namespaces are causing me some problems :
SortedList GetLogonData(string soapData)
{
XmlDocument soapDataXdoc = new XmlDocument();
soapDataXdoc.LoadXml(soapData);
XmlNamespaceManager nsMgr = new XmlNamespaceManager(soapDataXdoc.NameTable);
nsMgr.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
nsMgr.AddNamespace("", "http://www.domain.com/EP/");
XmlNode logonNode = soapDataXdoc.SelectSingleNode("soap:Envelope/soap:Body/Logon", nsMgr);
SortedList returnValue = new SortedList();
foreach(XmlNode xn in logonNode.ChildNodes)
{
returnValue.Add(xn.Name, xn.InnerText);
}
return returnValue;
}
In theory this should return a sorted list with the following values
userId - int
strPassword - string
strSessionId - session
But when I retrieve the logonNode this returns null, which I believe is being caused by an incorrect xpath, but I do not know why it is incorrect.
Could anybody point me in the right direction?
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Using an empty namespace prefix doesn't work in .NET 1.x. Specify a namespace prefix in your code. The namespace prefixes don't have to match, so you can have the default namespace in your <Logon> element but use a namespace prefix in your code.
Also, to avoid adding the other namespaces, you could always add the namespace with a prefix (let's say "l") and just use an XPath expression like "//l:Logon" to get the node. Just a thought.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Not sure if I undertstood correctly, but I have essentially modified my code to the following :
XmlNamespaceManager nsMgr = new XmlNamespaceManager(soapDataXdoc.NameTable);
nsMgr.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
nsMgr.AddNamespace("blank", "http://www.domain.com/EP/");
XmlNode logonNode = soapDataXdoc.SelectSingleNode("soap:Envelope/soap:Body/blank:Logon", nsMgr);
Also tried this :
nsMgr.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
nsMgr.AddNamespace("blank", "http://www.domain.com/EP/");
XmlNode bodyNode = soapDataXdoc.SelectSingleNode("soap:Envelope/soap:Body", nsMgr);
foreach(XmlNode xn in bodyNode.ChildNodes)
{
xn.Prefix = "blank";
}
XmlNode logonNode = soapDataXdoc.SelectSingleNode("soap:Envelope/soap:Body/blank:Logon", nsMgr);
Actually I definately didnt understand, as that didnt work
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
If you select a node using the XmlDocument instead of the DocumentElement , you must use a beginning "/" which uses a scope from the root element. The following sample works fine:
using System;
using System.Xml;
public class Test
{
static void Main()
{
XmlDocument doc = new XmlDocument();
doc.Load("Test.xml");
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
nsmgr.AddNamespace("l", "http://www.domain.com/EP/");
XmlNode logonNode = doc.SelectSingleNode(
"/soap:Envelope/soap:Body/l:Logon", nsmgr);
if (logonNode != null)
{
foreach (XmlNode child in logonNode.ChildNodes)
Console.WriteLine("{0}: {1}", child.Name, child.InnerText);
}
}
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want that while editing the textBox when I reach the edge
of the column to automaticly start a new line and when
finished that the text will be displayed that way.
|
|
|
|
|
I'm pulling out what little remaining hair I have again. I have a list box with 8 items, the selected item is highlighted at the top of the list. I press a button (cmdMoveDown) and wish to move the selected item 1 item down the list.
I tried this:
public void MoveDown()<br />
{<br />
int index = this.lstSelected.SelectedIndex;<br />
int newindex = index + 1;<br />
<br />
DataTable dtSelect = (DataTable)this.lstSelected.DataSource;<br />
DataRow dr = dtSelect.Rows[index];<br />
<br />
dtSelect.Rows.Remove(dr);<br />
dtSelect.Rows.InsertAt(dr, newindex);<br />
}
this removes the item at index 0 just fine. But the insert doesn't happen and there is a blank line at the bottom of the list.
then i tried this variation:
public void MoveDown()<br />
{<br />
int index = this.lstSelected.SelectedIndex;<br />
int newindex = index + 1;<br />
<br />
DataTable dtSelect = (DataTable)this.lstSelected.DataSource;<br />
DataRow dr = dtSelect.Rows[index];<br />
DataRow drNew = dtSelect.NewRow();<br />
<br />
foreach(DataColumn dc in dtSelect.Columns)<br />
drNew[dc.ColumnName] = dr[dc.ColumnName];<br />
<br />
dtSelect.Rows.Remove(dr);<br />
dtSelect.Rows.InsertAt(drNew, newindex);<br />
}
this variation removed the selected item and added the new row at the end of the list rather than at new index.
I tried various permutations of this code and could get nothing to work. Any suggestions?
|
|
|
|
|
A lot of this depends on how your data source is bound to the ListBox . When you update your DataTable like that, the changes may not be reflected in the ListBox . See the CurrencyManager for more information about a way to refresh the bindings, like calling Refresh on the CurrencyManager you can get from the ListBox.BindingContext (inheritted from the Control class).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Okay. I traced through the previously posted code and the data is actually being inserted into the table correctly and at the correct position. It is the DefaultView which is causing the list to display in the wrong order.
I added the following to the method:
CurrencyManager cmSelect = (CurrencyManager)this.lstSelected.BindingContext(dtSelect);<br />
cmSelect.Refresh();
It runs without error, but nothing changes. Can anyone suggest another approach?
|
|
|
|
|
Then create a DataView on the table and set that as the DataSource .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm Developing a WebApplication in which i have to pass parameter to DLL present in a remote computer and return the values returned by the DLL to the user... someone please help me in doing this....
|
|
|
|
|
You can't load a DLL from a remote computer and have it executed on the remote computer. You need some sort of RPC (remote procedure call), such as DCOM, COM+, .NET Remoting (preferred in .NET applications), or Web Services (if the other machine has IIS installed). In those cases you could P/Invoke the exported function from that DLL (if it's native), thus wrapping the unmanaged function in a managed class (or a native DCOM or COM+ executable).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I was thinking of combining a Diffgram Dataset with using Web Services. From my readings I noticed that I can save a dataset as a diffgram to a file after I do updates/inserts/deletes on the dataset. Then when I need to do more updates/inserts I reread the diffgram into a dataset and if I am connected to a database then use a dataadapter to update the database with changes. Is this correct in my assumption of how I can use the diffgram? I would create a Web Service to accept the Diffgram Dataset and have it create a DataAdapter to update the database. How does this sound? Any ideas?
Thanks,
JJ
|
|
|
|