|
Thanks for reply Mav. I had tried that before with
foreach (object obj in group1.serializedhashtable)
{
myarray.Add(obj);
}
But then when I try to serialize the arraylist I get an error "There was an error generating the XML document.".Here is the code snippet
// 'Open a filestream to write the contents
FileStream filest = new FileStream("newhashtable.txt", FileMode.Create);
XmlSerializer xs = new XmlSerializer(typeof(ArrayList), new Type[] { typeof(System.Int32), typeof(System.DateTime), typeof(System.String), typeof(System.TimeSpan) });
xs.Serialize(filest, myarray);
filest.Close();
Here are the exception details.
--------------------------------------------------------------------------------------------
System.InvalidOperationException was unhandled
Message="There was an error generating the XML document."
Source="System.Xml"
StackTrace:
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(Stream stream, Object o)
at Module1.serialize() in D:\Project\actual csharp solution\Program.cs:line 96
at Module1.Main() in D:\Project\actual csharp solution\Program.cs:line 42
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
--------------------------------------------------------------------------------------------------------
Thanks you,
Lokesh
|
|
|
|
|
In contrast to this if I add these variables directly into the arraylist(instead of copying them from hashtable) I can generate the XMl document without any errors.
For eg: If I add the variables directly into the array..then its no problem
myarray.Add(i);
myarray.Add(j);
myarray.Add(k);
myarray.Add(l);
|
|
|
|
|
I am writing a WPF application which shows video content.
The PC will run 24 hours a day and is protected from power loss by a UPS. If the mains power goes down for over a minute, the UPS software sends the PC into hybernation. When the power is restored the PC resumes, however... The application which was showing the video now shows nothing (blank space).
Is there a way of detecting the immanent hybernation in order to gracefully stop the videos, and restart them or the application when the PC resumes?
gmar
|
|
|
|
|
Looking at Microsoft.Win32.SystemEvents.PowerModeChanged might help.
xacc.ide
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
Thank you that is definitely worth looking up.
gmar
|
|
|
|
|
I have a log-in window application. When the user presses the cancel button it kills another window by it's name and then it exits. The problem is that if somebody kills the log-in window by terminating the process in the task manager the other window is not killed.
One solution might be to have a surveillande thread which doesn't die when the mother-thread dies, and can't be killed in the task manager. As soon as the log-in window thread stops responding to surveillance messages it will kill the other window and then exit.
Is this possible?
I've also tried to have a form which spawns another form, but in the Task Manager there is only one entry (PasswordDialog.exe). If you kill this process everything dies and the window which I want to kill when the log-in window dies is not killed.
|
|
|
|
|
check the IsBackGround property of thread..............
My small attempt...
|
|
|
|
|
Doesn't work, window remains. I set IsBackground to true.
|
|
|
|
|
Implement the surveillance functionality as a windows service. That way you can easily let it run from a privileged account and a non-admin user won't be able to kill these processes.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi buddies,
There are lots of small size picturebox on one picturebox control says picMain.At a time, I am moving only 1 picture on picMain on Mouse_Move event. But,I see problem with moving picture. Moving picture gets blur or I can say It need some re-draw.
so,I have use Invalidate() and update() to make the solutions but not getting any solution.
Instead of picMain if I try same thing on form, then it work very smoothly.I think picture box take more time to re-draw compare to form.
Pls help !!!
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
I'm not sure what help you need. You've worked out the answer I would give, don't use pictureboxes, pretty much ever. Just draw the image yourself.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Mr Graus.
My work is working fine only when child picture boxes are on form control, but now as my requirement got change, I have to move every child picturebox on picture box ctrl ( instead of form control ).
When i move the child picturebox on picture control from xy1 location to xy2 location then picture looks like blur ( it seems that its own ghost is following at each mouse_move event).I am not getting the smotheness in dragging just as we get in Visual studio in design time during dragging ctrl from toolbox.
pls reply
thx
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
You have alredy post that question, a few day ago...... if i am not wrong....
Your Same Post.....[^]
and my answer was...
Private dragging As Boolean
Private beginX, beginY As Integer
Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
dragging = True
beginX = e.X
beginY = e.Y
End Sub
Private Sub PictureBox1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
dragging = False
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If dragging = True Then
PictureBox1.Location = New Point(PictureBox1.Location.X + e.X - beginX, PictureBox1.Location.Y + e.Y - beginY)
Me.Refresh()
End If
End Sub
|
|
|
|
|
please help me,
I want to store and retreave word document in sql server using c#.net
bobin
|
|
|
|
|
Create a BLOB in a table the database, serialize the word document to a byte stream and save it in the database. To recreate it, you would need to deserialize the byte stream and write it to a file. It's probably worth having a column with the original filename of the document in.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hi guys
i have a usercontrol which consists on a listview ,and two buttons(ok and cancel).
now i have placed this control on my windows form,
now i want when i press enter key so the event handler of button ok should fire,
like we do on normal
me.acceptbutton = buttonok (e.g)
but i cant do it here because buttonok is private in my user control. i have buttonok event handler which i can handle , but i want to user enter key for that .
any solution
thanks in advance
hello
|
|
|
|
|
Hello,
Add a read property from Type System.Windows.Forms.Button to the UserControl, and return the button instanz.
//UserControl "UCListView" code:
public Button AcceptButton
{
get
{
return okButton;
}
}
//Forms code:
this.AcceptButton = ucListView1.AcceptButton;
Hope it helps!
All the best,
Martin
|
|
|
|
|
thanks this can work, but dear if it is not less secure.
i will give my okbutton publicily to my user which i dont want to do.
coz in this way the user will have full access on this button because he can get
its refderence from
this.AcceptButton = ucListView1.AcceptButton
am i right ?
hello
|
|
|
|
|
hi
With gdi+ we can draw every thing we want, but I want to write a string in a form over all of the control. When I use drawString() method the string is written on form but under the other control. what should I do?
|
|
|
|
|
Mabye the TextRenderer.DrawText can do it better? Please tell me if this works.
|
|
|
|
|
No
this method didn't solve my problem.
|
|
|
|
|
The string is written on the drawing surface of the form, which sits behind all the other controls on the form. AFAIK, no matter what, any drawing you do on the form will always show up behind the controls on it.
|
|
|
|
|
Hi,
This may sound very silly but please do help me to understand…
In C# we write
Textbox1.text=”hello”
My question is regarding the “”DOT”” what is its name and what is its functionality….
Now in this code how does the dot work…
obj.delegateobject = new windowsdelegates.Form2.nameofdelegate(SetText);
is it something that we use to pass values ?????
I am new to prgrmng and need you guys help…
Thanking you
k
|
|
|
|
|
At this point, you really don't know enough to be able to seek help here. I trust you are at school, and not being paid for your efforts. You should buy a book on C# and work through it. There's really no way that forum responses are going to help you much, because every answer you get is just going to raise more questions. Get a book, and work through it in a structured way.
The answer is that Textbox1 is a class, and text is a property of that class. The dot means that you're accessing a property or method of a class instance.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
thankyou sir....
i am looking for a book that is simple to understand since this is my fiorst step to pgrmg
C#
|
|
|
|