|
Perhaps setting the datasource to null and deleting the actual data on a background thread would help?
Alternatively, why put 100,000 rows in a datagrid, nobody will scroll through them all, so filter before load?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
i was tring to write some data to the parallel port using inpout32.dll but i keep getting this exception
SEHException was unhandled:
External component has thrown an exception
this is the code i used
class PortAccess
{
[DllImport("inpout32.dll", EntryPoint = "Out32")]
public static extern void Output(int adress, int value);
}
public void OUT()
{
PortAccess.Output(888, 1);
}
am i doing something wrong or wat?
|
|
|
|
|
It may be several problems, but it appears to be an issue with the access of the library or the port.
Which OS are you running ?
More over add this to your main app in order to get the information, please update us.
[STAThread]
static void Main(string[] cmdLine)
{
try
{
Application.ThreadException += ApplicationThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
...
}
catch (Exception exception)
{
...
}
finally
{
...
}
}
|
|
|
|
|
tnx 4 ur reply..
I am using WindowsXp SP2. and i posted only some part of the code, it is a windows form application on visiual studio 2008.
i called the PortAccess.output function on a button click event. every thing works fine until i click the button
|
|
|
|
|
did you try to add the global exception catch and dump its message
|
|
|
|
|
thanks but i got the solution. i download the updated INPOUT32.dll from http://www.logix4u.com and it worked
|
|
|
|
|
pls provide the same DLL to me...
|
|
|
|
|
THE SEHException is really nasty to debug. Because it comes from the COM.
I was able to resolve this nasty bug only by uninstalling .NET 3.5 SP1 and reinstalling again. Because I use windows 7 I had to do this from my windows add/remove components section.
Others suggestions like reseting IIS failed.
VJ Koganti
http://www.PrintersRose.com/
|
|
|
|
|
Hi all...
I'm asking of how i can encrypt and decript a txt file using C#,
i think u don't mined to help me ...
Thank u...............
|
|
|
|
|
|
because you want both Encrypting and Decrypting I would offer you gunzipstream
public string Decode()
{
FileStream fs = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\MyFile.dat", FileMode.Open, FileAccess.ReadWrite);
byte[] array = new byte[400];
GZipStream gstream = new GZipStream(fs, CompressionMode.Decompress);
gstream.Read(array, 0, array.Length);
gstream.Close();
string Mytext = Encoding.UTF8.GetString(array);
return Mytext;
}
public void Encode(string text)
{
byte[] array = Encoding.UTF8.GetBytes(text);
FileStream fs = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\MyFile.dat", FileMode.Create, FileAccess.ReadWrite);
GZipStream gstream = new GZipStream(fs, CompressionMode.Compress);
gstream.Write(array, 0, array.Length);
gstream.Flush();
gstream.Close();
}
note: this solution is not completely secure!
|
|
|
|
|
Hi,
How could you make this happen on the click of a button? I've tried adding it to the event but the Public void Encode(string text) line obviously stops this happening.
edit: Some of my terminology may not be correct, so if your unsure, just ask.
modified on Monday, December 21, 2009 10:41 AM
|
|
|
|
|
just insert button on the form and double click it, Then
write button1_Click event code like shown.
In this sample I encoded text of TextBox1 to 'Myfile.dat' in My Document
note: must copy Encode function to Form class
private void button1_Click(object sender, EventArgs e)
{
Encode(TextBox1.Text);
}
public void Encode(string text)
{
byte[] array = Encoding.UTF8.GetBytes(text);
FileStream fs = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\MyFile.dat", FileMode.Create, FileAccess.ReadWrite);
GZipStream gstream = new GZipStream(fs, CompressionMode.Compress);
gstream.Write(array, 0, array.Length);
gstream.Flush();
gstream.Close();
}
modified on Thursday, December 24, 2009 10:23 AM
|
|
|
|
|
I get the following error when my code is run: "The given path's format is not supported."
The error is in this line:
FileStream fs = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "MYFILE.txt", FileMode.Create, FileAccess.ReadWrite);
It cant be a problem with my txt file i dont think, because i have used them before in my programs and they have worked fine. Any help would be appreciated.
Extra information:
- Using VS 2008
- .NET Framework 3.5 SP1
|
|
|
|
|
thanks
you forget the "\\" before "MYFILE.txt"
corrct that to this:
FileStream fs = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\MYFILE.txt", FileMode.Create, FileAccess.ReadWrite);
|
|
|
|
|
Thanks for your help so far. Just 1 more question. Ive managed to succesfully encrypt the data that is inputted into textbox1, but decoding it fails.
public Form1()
{
InitializeComponent();
Decode();
}
private void button2_Click(object sender, EventArgs e)
{
Decode();
StreamReader rb = new StreamReader("C:\\file.txt");
MessageBox.Show(rb.ReadToEnd());
rb.Close();
}
public string Decode()
{
FileStream fs = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\file.txt", FileMode.Open, FileAccess.ReadWrite);
byte[] array = new byte[400];
GZipStream gstream = new GZipStream(fs, CompressionMode.Decompress);
gstream.Read(array, 0, array.Length);
gstream.Close();
string Mytext = Encoding.UTF8.GetString(array);
return Mytext;
}
It doesnt return any errors, it just clears the file.
Any help would be appreciated
|
|
|
|
|
Never mind, figured it out. Its amazing what a bit of sleep can do.
Thanks
|
|
|
|
|
<br />
string mm = dateTimePicker1.Value.ToShortDateString().ToString();<br />
string nn = dateTimePicker2.Value.ToShortDateString().ToString();<br />
SqlCommand SCD = new SqlCommand("select * from table_inf where tim>=@mm and tim<=@nn", Conn);<br />
SCD.Parameters.AddWithValue("@mm", mm);<br />
SCD.Parameters.AddWithValue("@nn", nn);<br />
<br />
<br />
sqlDataAdapter1.SelectCommand = SCD;<br />
sqlDataAdapter1.Fill(DT);<br />
Conn.Open();<br />
dataGridView1.DataSource = DT;<br />
when i chosen dateTimePicker1 on today and chosen dateTimePicker2 on today too,it can't select Today'data....when you want to select today'data,you must change dateTimePicker2 on tomorrow,it's trouble! How can i chosen dateTimePicker1 on today and chosen dateTimePicker2 on today also can chosen Today's Data!
i try to change "tim" to "convert(varchar(12),tim,105)",but it also do not work for me.
i don't know how to change my Code ,thanks to everyone!
i,m poor in english,sorry
i use DATA sql2000
i have put this problem on here twice,thanks to everyone
|
|
|
|
|
You just posted once a bit earlier same question and you have some answers too for your question.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
The value of mm is the same as the value of nn. You are cutting the time part which is the most important here. You should check dates between this interval [15.12.2009 00:00:00.001 - 15.12.2009 23:59:59.998] (and change the format in desired culture)
I didn't notice that this question is re-posted! Man this is kind a rude! You've already got a good answer, so why re-post ?!
|
|
|
|
|
Can someone explain the difference between:
lock (someobject) {}
Using Mutex
Using Semaphore
Using Monitor
Using Other .Net synchronization classes
I just can't figure it out. when to use what ?
|
|
|
|
|
|
DateTime mm = dateTimePicker1.Value;<br />
DateTime nn = dateTimePicker2.Value;<br />
SqlCommand SCD = new SqlCommand("select * from table_inf where tim>= @mm and tim<=@nn", Conn);<br />
SCD.Parameters.AddWithValue("@mm", mm);<br />
SCD.Parameters.AddWithValue("@nn", nn);<br />
<br />
<br />
sqlDataAdapter1.SelectCommand = SCD;<br />
sqlDataAdapter1.Fill(DT);<br />
Conn.Open();<br />
dataGridView1.DataSource = DT;
when i chosen dateTimePicker1 on today and chosen dateTimePicker2 on today too,it can't select Today'data....when you want to select today'data,you must change dateTimePicker2 on tomorrow,it's trouble! How can i chosen dateTimePicker1 on today and chosen dateTimePicker2 on today also can chosen Today's Data!
i don't know how to change my Code ,thanks to everyone!
i,m poor in english,sorry
i use DATA sql2000
|
|
|
|
|
Our problem is that you have he following being executed...
WHERE tim >= 01-DEC-2009 00:00:00 AND tim <= 01-DEC-2009 00:00:00
(or something like that)
because DateTimePicker.Value is a DateTime not a Date.
SO you need to convert your mm to truncate the time portion and your nn to truncate the time and add one day, and change the WHERE to
WHERE tim >= @mm and tim < @nn
(i.e. use less than not less than or equal to)
If DateTimePicker returns the date with a zero time (i.e. midnight on that day) then you just need to change the <= to < and change
SCD.Parameters.AddWithValue(@nn, nn.AddDays(1))
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
thanks,that's it
i' ll do it
|
|
|
|