|
To get the USB drive SN is not a hard think, you can find articles in CP about USB and Hardware information, and perhapes on Google
The privet authentication is mutch harder. As I know the explorer starts befor the applications stroed in then registry/Run start. So I thik there is no way to strat an application before explorer starts. But if you find out how to the windows logon screen work, you can paste yor verification to this screen.
|
|
|
|
|
hi nemopeti:
thanks for ur help...
I will try some other way...
My boss is so stern
|
|
|
|
|
My debugger says that it can't find WindowsSolution9.exe when I attempt to debug. It happened yesterday and a friend fixed it. How do I fix this, and can I make it stop?
|
|
|
|
|
Hey
I'm really trying to serialize a listbox in my form, but I just keep getting an exception that tells me that it is not serializable
I'm writing down the code of the Main form.
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
<br />
using System.Runtime.Serialization;<br />
using System.Runtime.Serialization.Formatters.Binary;<br />
<br />
namespace Serialize_ListBox<br />
{<br />
<br />
[Serializable()]<br />
public class MainForm : System.Windows.Forms.Form, ISerializable<br />
{<br />
private System.Windows.Forms.ListBox lbText;<br />
private System.Windows.Forms.Button btnSave;<br />
private System.Windows.Forms.Button btnAdd;<br />
private Form ThisForm;<br />
private System.ComponentModel.Container components = null;<br />
<br />
<br />
<br />
public MainForm()<br />
{<br />
InitializeComponent();<br />
<br />
<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if( disposing )<br />
{<br />
if (components != null) <br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
private void InitializeComponent()<br />
{<br />
}<br />
#endregion<br />
<br />
[STAThread]<br />
static void Main() <br />
{<br />
Application.Run(new MainForm());<br />
}<br />
<br />
private void btnAdd_Click(object sender, System.EventArgs e)<br />
{<br />
AddDialog dlgAddText = new AddDialog();<br />
<br />
if(dlgAddText.ShowDialog() == DialogResult.OK)<br />
{<br />
lbText.BeginUpdate();<br />
lbText.Items.Add(dlgAddText.txtAdd.Text);<br />
lbText.EndUpdate();<br />
}<br />
}<br />
<br />
private void btnSave_Click(object sender, System.EventArgs e)<br />
{<br />
System.IO.Stream stream = System.IO.File.Open("listbox.bla", System.IO.FileMode.OpenOrCreate);<br />
BinaryFormatter BF = new BinaryFormatter();<br />
<br />
BF.Serialize(stream, lbText);<br />
stream.Close();<br />
MessageBox.Show("ListBox Saved");<br />
}<br />
<br />
<br />
public MainForm(SerializationInfo info, StreamingContext ctxt)<br />
{<br />
lbText = (ListBox)info.GetValue("List", typeof(ListBox));<br />
}<br />
<br />
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)<br />
{<br />
info.AddValue("List", lbText);<br />
}<br />
<br />
<br />
}<br />
<br />
}<br />
<br />
till now I serialized strings with no problems, and I don't know why its not working now.
help anyone???
Thanks ALot!
|
|
|
|
|
it doesn't work because listbox doesn't implement the ISerializable interface...
try to serialize the datasource of your listbox... if it is an array of string,
it can be serialized without any problem.
|
|
|
|
|
I'm sorry for the complete ignorance, but how do I serialize the datasource?
do you mean serializing each string, one by one?
|
|
|
|
|
try this:
<br />
string[] items;<br />
items=new string[listbox.Items.Count]<br />
for(int i=0;i<listbox.Items.Count;i++)<br />
{<br />
items[i]=(string)listbox.Items[i];<br />
}<br />
info.AddValue("List",items);<br />
|
|
|
|
|
still not working...
I get a null exception in this line: ('cnt' in my program is the 'i' in your example)
items[cnt] = (string)lbText.Items[cnt];
I get the exception in cnt=0 even though lbText.Items[0] has a string in it, and it is not null.
|
|
|
|
|
okay, I figured it out, and it serializes the array, but it serializes only the first item.
|
|
|
|
|
hmmm?!
it should work! perhaps you don't serialize/deserialize with the right type?
try this:
serialize:
<br />
string[] items;<br />
...<br />
info.AddValue("listbox",items,typeof(string[]));<br />
deserialize:
<br />
string[] items;<br />
items=(string[])info.GetValue("listbox",typeof(string[]));<br />
|
|
|
|
|
it works!
I had to turn the items[] into a member because thats what I need to serialize in the serialization command:
BF.Serialize(stream, items);
and if I just create the array in the serialize or the deserialize it doesn't exist for me to serialize.
Thanks alot!!!
I have just two more REALLY small questions (and I think your the MAN with the answers!):
1. is there anyway to serialize an object as is? I mean, list
just serializing a listbox or a combobox, and all the infomation inside will be saved?
2. I don't get exactly what the Initialize() command in the array class is doing, or when should I use it...
Thanks Again!
|
|
|
|
|
Green Fuze wrote:
1. is there anyway to serialize an object as is? I mean, list
just serializing a listbox or a combobox, and all the infomation inside will be saved?
Search for "Control.DataBindings Property" in your vs.net help or msdn.
I think that's what you are looking for.
Green Fuze wrote:
2. I don't get exactly what the Initialize() command in the array class is doing, or when should I use it...
Search for "Array.Initialize Method" in your vs.net help or msdn too.
Mostly you don't need to call this method. For example you have an array of string, the compiler sets all strings inside this array automatically to an empty string.....
|
|
|
|
|
How do I add a line in a textbox through code to display something like this?
111
222
333
Rather than.
111222333
Thanks, this is easy, but I forgot what the sort code was, I think that it was like &ensp or something. Thanks.
|
|
|
|
|
\r\n should do it.
111\r\n222\r\n333
John 3:16: "For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life."
|
|
|
|
|
|
As the two posters above me replied, you can use "\r\n" or Environment.NewLine. The latter option is the recommended one though. It'll work depending on the platform you're running on, for eg. Unix's newline character is only "\n".
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
After creating an application in C# that runs fine on my computer and another developer's computer, we included it in an InstallShield project. When we try to run it we see the message box saying:
Common Languge Runtime Debugging Services
Application has generated an exception that could not be handled.
Process id=0xb3c(2876), Thread=0xb40(2880)
Click OK to terminate the application.
Click CANCEL to debug the application.
I've created a Release version but that didn't seem to matter. We have another program that's written in .NET that works fine. I've seen many postings on this error on the net but no solutions. Any ideas?
|
|
|
|
|
The most common thik of an error msg like this listed below (as I know):
- framework not installed
- some require component not installed/registered
So if you use a dll or ocx you must register it, in the other machine too.
eg.:
from command line:
regsvr32 mycomponent.ocx
or
regsvr32 mycomponent.dll
|
|
|
|
|
Actually you are close, we figured it out. My program is using an Access database via a datasource connection. When the program begins to load, it attempts to connect to the datasource. Unfortunately the connection path is hardcoded and the installation computer did not have the same directory structure. So when the program started it could not find it's datasource. We changed the path and moved the database to the right directory and it worked.
Ahhhh engineering!
Normality is a weakness...
|
|
|
|
|
I have a problem using system.transactions ...it doesnt have a transaction
Class unitofwork....
public override void Commit()
{
using (TransactionScope scope = new TransactionScope())
{
Application.ConnectionManager.OpenConnection();
InsertNew();
updateDirty();
deleteRemoved();
//Application.ConnectionManager.CloseConnection();
scope.Complete();
}
|
|
|
|
|
|
hi all.
i have alittle problem ?
how can i show different font styles and font colors for different lines in textboxes or even listboxes ?
Miss With The Best And Die Like The Rest
|
|
|
|
|
snouto wrote:
how can i show different font styles and font colors for different lines in textboxes
Use a RichTextBox.
snouto wrote:
or even listboxes
Owner draw. Which also applies to a TextBox, if you don't want to go the RTF route.
Marc
My website
Latest Articles:
Undo/Redo Buffer
Memento Design Pattern
|
|
|
|
|
so how can set specific font for each line in richtext box
by code please
Miss With The Best And Die Like The Rest
|
|
|
|
|
You might check out the documentation on the RichTextBox here[^].
|
|
|
|