|
Hello,
Have you debugged it?
The problem is, that you handle the MouseDown of the Button, and then try to cast the sender (which is the Button) to a PictureBox.
I would say, that "PictureBox x" (in your "cxt_btn_transfoVerwijder_MouseDown") is "null".
Apart from that, you should also Dispose the Instance of the PictureBox and remove all other references.
P.S.: Naming an PictureBox "x" doesn't make it easy for us to help you!
All the best,
Martin
|
|
|
|
|
Hi,
Can someone tell me how to extract images and store it separately from an excel file using C# code?
Regards
Diptanil
|
|
|
|
|
If you try to extract a excel generated diagramm, the only chance is via screenshot. you cannot render the grafic without opening excel.
|
|
|
|
|
Hi,
I have some images which are not generated by Excel itself. I need to invoke a program which will read the excel file and store the imgaes inside separately. Can you help me with a valid C# code for doing that.
Regards
|
|
|
|
|
Hi,
I am a small business owner looking for an individual to finish and maintain an Outlook plug-in written in C#. The application is functional at this point but needs an installer and exposure to clients and subsequent bug fixes along with occasional revisions.
If you are interested in a small long term project please feel free to make contact.
|
|
|
|
|
Dear all,
I have two treeviews on my form , and the afterselect method on both of them is like this :
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)<br />
{<br />
tabControl1.Visible = false;<br />
}<br />
<br />
private void treeView2_AfterSelect(object sender, TreeViewEventArgs e)<br />
{<br />
tabControl1.Visible = true;<br />
}
The problem that I have, is that the tabcontrol that I would like to hide or show, only hides or shows once. After that, nothing happens anymore if I click on either treeviews. I tried attaching a messagebox to the methodes for debug reasons, but they don't show either. It looks like the afterselect method is not being called the second or third time I click on it.
Can anyone help me out please ?
kind regards,
Rick
|
|
|
|
|
The AfterSelect event fires after you select a specific node on the treeview, not the treeview itself. Once this has been selected, it will not fire again untill you select another node on the same tree. Sounds like what you want is to simply perform an action when a treeview is clicked, so you might as well use the Click event. Hope this helps.
Standards are great! Everybody should have one!
|
|
|
|
|
Hi,
Please try the following code snippet:
BEGIN CODE
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
this.tabControl1.Visible = false;
}
private void treeView2_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
this.tabControl1.Visible = true;
}
END CODE
I hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Thanks, but I don't need any help, you might want to reply to the original poster .
Standards are great! Everybody should have one!
|
|
|
|
|
i think he was in hurry
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Does anybody know a way that I can perform the deserialization of the xml into a List<T> that doesn't require me to create a class that inherits List<> and overrides the serialization?
My current predicament is that I have the following Xml doc:
<Outstanding>
<WorkItem UserId="2014C908-1FD3-447C-B6EA-56DDB1602E45">
<TotalItems>74</TotalItems>
<Tables>
<Table Id="0">
<Name>Table0</Name>
<ItemCount>74</ItemCount>
</Table>
</Tables>
</WorkItem>
<WorkItem UserId="E40B31E5-E342-424C-A12B-8EF2D819DB3E">
<TotalItems>41</TotalItems>
<Tables>
<Table Id="0">
<Name>Table0</Name>
<ItemCount>41</ItemCount>
</Table>
</Tables>
</WorkItem>
</Outstanding>
And I have the following class:
public class WorkItem
{
#region Member variables
private int _totalItems;
private List<WorkItemTable> _tables;
private Guid _userId;
private MembershipUser _user;
#endregion
public MembershipUser User
{
get { return _user; }
}
public int TotalItems
{
get { return _totalItems; }
}
public List<WorkItemTable> Tables
{
get { return _tables; }
}
}
As you can see the class doesn't match the Xml doc especially the User property, ideally I want to get the userId from the Xml doc and then query the Membership provider to return me the actual MembershipUser object.
I have tried using IXmlSerializable, the ReadXml specifically is:
public void ReadXml(System.Xml.XmlReader reader)
{
reader.MoveToElement();
reader.MoveToFirstAttribute();
_userId = new Guid(reader.Value);
reader.ReadToFollowing("TotalItems");
// Try and get the total items
if (!int.TryParse(reader.ReadElementString("TotalItems"), out _totalItems))
throw new SerializationException("Unable to de-serialize WorkItem due to problem with TotalItems element");
// Now we have read the specific items for the WorkItem de-serialize the tables
XmlSerializer serializer = new XmlSerializer(typeof(List<WorkItemTable> ), new XmlRootAttribute("Tables"));
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "");
_tables = (List<WorkItemTable> )serializer.Deserialize(reader);
}
Which works fine for a single WorkItem element but when I attempt to execute:
XmlSerializer s = new XmlSerializer(List<WorkItem> );
TextReader reader = new StringReader(xmlData);
s.Deserialize(reader);
The XmlSerializer passes a reader that iterates over all of the WorkItem elements which means I end up with only a single item in the list rather than multiple items entered in the Xml.
|
|
|
|
|
When you have a List of WorkItems, you have to call the Deserialize (which inturn calls the ReadXML) multiple times to load the complete list. You will have to iterate thru the XML Reader (thru the list of WorkItem elements serialized into a single XML file) and call the Deserialize for each WorkItem element, and add the retrived WorkItem to a list. With this logic you can finally populate the List of WorkItems loaded back from XML, into which you have previously serialized the list of WorkItems.
You can try this -
TextReader reader = new StringReader(xmlData);
System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create( reader );
List&lt;WorkItem&gt; workItemList = new List&lt;WorkItem&gt;( );
try
{
xmlReader.ReadStartElement( );
while ( ( xmlReader.MoveToContent( ) == XmlNodeType.Element &amp;&amp; xmlReader.LocalName == typeof( WorkItem ).Name ) )
{
workItemList.Add( ( WorkItem )new XmlSerializer( typeof( WorkItem ) ).Deserialize( xmlReader ) );
xmlReader.Read( );
}
}
catch (Exception ex)
{
}
finally
{
xmlReader.Close();
Reader.Close();
Reader.Dispose();
}
|
|
|
|
|
I have created an C# application to compile C# and VB code. Now I want to extend it to Visual J# as well. Is there any specific class for that(as there are CSharpCodeProvider and VBCodeProvider for C# and VB)??
Also, can I post the code for review??
modified on Tuesday, February 26, 2008 7:21 AM
|
|
|
|
|
And how is the VJSharpCodeProvider not working for you?
|
|
|
|
|
i_want_to_learn_c# wrote: Also, can I post the code for review??
No. We dont get paid to do that.
|
|
|
|
|
Hello guys...
I am facing the following problem when i debug my application but it builds successfully.
this is the error message with header ....loaderlock detected..
VoiceChat\bin\Debug\Microsoft.DirectX.DirectSound.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
please let me know if someone know how to solve it...
modified on Tuesday, February 26, 2008 8:33 AM
|
|
|
|
|
Are you using this in a Web application?
|
|
|
|
|
I have developed a windows service that takes the screenshot and saves in server machine with start-up type Automatic, which is required.When the machine of client is restarted, it shows win32 exception of sqlmngr.exe and service cant be started.Is there any way to remove this exception.
Note that start-up type Automatic is required.
Thanx in advance.
|
|
|
|
|
1. Is there a stack trace?
2. Is your service doing anything with SQL Server?
3. Have you enabled the Allow service to interact with Desktop option?
4. Have you (after the service dies) tried starting it manually to see what happens?
Cheers,
Vikram.
"real dictators don't loose[sic] elections." - Diego Moita.
|
|
|
|
|
Actually every screenshots taken is stored in server part and since there are more than one client it definitely uses SQL server.And,Allow service to interact with desktop is already enabled.Everything works fine,but after restarting the computer it shows the exception but if done manually it works fine saving screenshots in server machine.So how to avoid this exception?
Thank you.
|
|
|
|
|
Sounds like you have a dependency issue. Your service is dependent on Sql Server having started so you need to add a dependency to it to do this.
|
|
|
|
|
Sorry but adding dependency to the service also doesnot work out.It shows same exception of sqlmngr.exe.Help please.
|
|
|
|
|
Hi, I am facing an issue in serialization. I have a class that implement ISerializable interface. Actually I want to make my object to travel on the network. If I don’t implemetn the ISerializable interfce and use the following code I can get the same functionality.
public static Object GetSerializedObject (Object pObject)
{
try
{
BinaryFormatter objBinaryFormatter = new BinaryFormatter();
MemoryStream objMemoryStream = new MemoryStream();
objBinaryFormatter = new BinaryFormatter();
objBinaryFormatter.Serialize(objMemoryStream, pObject);
objMemoryStream.Position = 0;
Object objReturnedObject = (object)objBinaryFormatter.Deserialize(objMemoryStream);
objMemoryStream.Flush();
objMemoryStream.Close();
objBinaryFormatter = null;
return objReturnedObject;
}
catch (Exception objException)
{
throw;
}
}
Please guide me which is the best practice that I should follow. Is there any difference in the approches. There is no constrant to serialize some attribute of the class, the whole object should be serialized.
Regards,
modified on Tuesday, February 26, 2008 8:11 AM
|
|
|
|
|
You don't need to implement the ISerializable interface. Just decorate your class with the [Serializable] attribute and you are fine.
|
|
|
|
|
can anyone tell me how to write an image inside a cell as a comment in Excel using C#
-----Have A Nice Day-----
|
|
|
|