|
Thanks for your reply and time.
also could you give some light on DataSet object i declared. Given the 2 approaches i used, Is my concern is correct i.e
a) By declaring DataSet at form level(outside method). Is this going to remain alive until form object is alive?
Am i correct here?
regards
|
|
|
|
|
if your DataSet were a class member of your form, it would stay alive as long as a reference to it exists, which probably would coincide with the life of the form. You should be aware that DataSet has a Dispose() method which you should call when you no longer need the DataSet, so either apply a using construct (that is only suitable for local memory, inside a single method) or make sure to stuff it in a FormClosing handler.
|
|
|
|
|
Dear All,
I need a little help here.
Currently I have a website which is not under secure (E.g non-SSL pages).
If the user clicks login, the system will verify whether the login page is a secure page. If it is not, it will had a change of the URL to "https://" instead of "http://" which brings the website to be under secure.
However, if the user logout, my website will disconnect the SSL connection.
Now my problem is, how to disconnect the SSL connection in C#?
I tried searching googles, forums, etc for about a week and most of the replies are by using "FormsAuthtication.SignOut()" but it does not work in my website.
I include "FormsAuthtication.SignOut()" and redirect to "http://" page, it give me an error:
"The page must be viewed over a secure channel
The page you are trying to view requires the use of "https" in the address.
HTTP 403.4 - Forbidden: SSL required
Internet Information Services"
Please give me advie on this.
Many thanks.
|
|
|
|
|
Hi
Im using AVIStreamWrite to create a video using a string of JPG's from a ethernet camera. I believe that I have to use aviSetFormat before I can use the above function. One of the arguments for the aviSetFormat function is a BITMAPINFOHEADER. I have tried settings it up manually but the video is just black. So is there a way of finding the BITMAPINFOHEADER of a image using a function call?
Thanks
|
|
|
|
|
There is some code here[^] that does what you are trying to do. Have a look to see if it helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Thank you for the reply. I have managed to get it to create avi's with uncompressed images but my problem is that I dont know how to add compressed images. I need to know the BITMAPINFOHEADER.Compressed parameter. Do you know how I can get this parameter from the image?
Thanks
|
|
|
|
|
According to A Simple C# Wrapper for the AviFile Library[^] you cannot add compressed images directly. It seems that you have to create a new Stream add them to that, then add the new stream. Anyway the article explains it better than I can.
Although, from a very quick read, it does not seem to use BITMAPINFOHEADER.Compressed it seems to manage the whole thing.
Once again, I hope that if it is not sufficient by itself, that it gives you some ideas.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas? - Because 31 Oct = 25 Dec.
Business Myths of the Geek #4 'What you think matters.'
|
|
|
|
|
Hi all,
I got small trobule with randomize
her my code for starting randomize
private void lblStart_Click(object sender, EventArgs e)
{
bool run;
run = true;
Random d = new Random();
Application.DoEvents();
while (run == true)
{
Application.DoEvents();
int rnd = d.Next(0, lst.Count - 1);
lblNumber.Text = lst[rnd].ToString();
}
}
here for stop randomize and show result in messagebox and Label
private void lblStop_Click(object sender, EventArgs e)
{
run = false;
MessageBox.Show(lblNumber.Text);
}
after I click stop button in label and messagebox it show the same text, but after I clcik OK button in label show another number?
Can anyone help to correct this?
Thanks
Socheat
|
|
|
|
|
All you are doing there is clogging up your processor, to no good end. Do it this way:
Create a class level Timer, call it randomTimer.
Move your Random to class level.
In your Start_Click event handler, check if there is an existing Timer in randomTimer. If not, create an instance, set the interval to 1/10th second, and set a handler for the Tick event. In all cases, start the timer.
In the Tick event, set the lblNumber.Text to your random value.
In your Stop_Click event handler, stop the timer.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Hi,
Can you write me example?
Thanks
Socheat
|
|
|
|
|
Here code I just used timer control but still can't use
bool run = true;
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Enabled = true;
this.Text = System.DateTime.Now.ToString();
run = true;
Random rnd = new Random();
int i = 0;
while (run == true)
{
Application.DoEvents();
i = rnd.Next(0, 1000);
textBox1.Text = i.ToString();
}
}
private void button1_Click(object sender, EventArgs e)
{
timer1_Tick(sender, e);
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
run = false;
MessageBox.Show(textBox1.Text);
}
Socheat
|
|
|
|
|
No.
Read up on Timer.
private Timer timer = new Timer();
private void buttonStart_Click(object sender, EventArgs e)
{
timer.Interval = 1000 / 100;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
void timer_Tick(object sender, EventArgs e)
{
... Do a single instance of your Random stuff.
}
private void buttonStop_Click(object sender, EventArgs e)
{
timer.Stop();
}
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
BTW: You don't need to send me an email as well as replying - the reply automatically sends an email. Just like this one, in fact...
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Hi,
your code contains a couple of mistakes against general rules, including:
1. event handlers (such as a Click handler) should execute and be done with in less than say 20 milliseconds; anything that takes longer needs a different approach, maybe a timer (a System.Windows.Forms.Timer is best for GUI related stuff), maybe a separate thread;
2. don't abuse Application.DoEvents(), there are a few situations where its use would be OK, yours isn't one of them.
3. avoid "busy loops", such as your while(run) construct, whenever there is an elegant alternative.
Obeying (1) often makes (2) moot.
Griff's approach is fine.
PS: please use PRE tags when including code snippets.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hey Luc, what situations are there where Application.DoEvents() would be OK?
|
|
|
|
|
I allow myself to use DoEvents() inside an event handler when I am sure there is no risk of the event handler being re-entered by doing so, and I want the GUI to settle before I continue. Case in point would be a MenuItem.Click handler on say an "Open File..." menu item, where I want the menu to disappear and the GUI restored ASAP before opening the dialog that was ordered.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
|
Hi all,
I can do it now.
I no need to remove Application.DoEvent(); otherwise my application will hang.
I just remove my while loop and add it in timer class, it OK now.
Thanks.
Socheat
|
|
|
|
|
If you have removed your while loop, and put the code into the timer, then you do not need Application.DoEvents(). If your app hangs without it, then you are still doing something very wrong!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Random d = new Random((int)(DateTime.Now().Interval));
Application.DoEvents();
while (run == true)
{
Application.DoEvents();
int rnd = d.Next(0, lst.Count - 1);
lblNumber.Text = lst[rnd].ToString();
}
}
|
|
|
|
|
Hi!! I really need help with this.
This is my first time programming using a database and I'm doing a system for a clinical laboratory... Each test belongs to a section, there are a total of five sections and each one is has its own table... There's also a "exam" table that relates all sections to the patient... Example:
Exam table has these fields:
ExamId
PatientId
HematologyId
ChemistryId
Hematology table has:
HematologyId
ExamId
Test1
Test2... etc.
Same for chemistry and all the five sections.
So basically what I need is to print the exam that is gonna be given to the patient... f.e: let's assume there are 10 hematology tests and 10 chemistry tests, and the patient needs the test #1, #4 and #6 from hematology and the tests #7 and #9 from chemistry... What I need to print is something like this:
Date
Patient Name
Age
Hematology:
Test #1: result
Test #4: result
Test #6: result
Chemistry:
Test #7: result
Test #9: result
I hope you could help me, I'm really lost and can't find the way to do that.. I need this to finish my degree and the only thing left is what I'm asking here...
Thanks in advance for your help.
modified on Friday, June 11, 2010 1:52 AM
|
|
|
|
|
|
Yeah... sorry... I'm from Venezuela so english is not my first language
|
|
|
|
|
Well, otherwise, your English is quite excellent. It is good enough that I couldn't tell it was not your first!
|
|
|
|
|
Thank you!! I use to check the spelling when I'm writing in english because I hate to feel that I'm writing bad whatever the language it is... Don't know how I missed that one... I already edited it so it's fixed.
Any recommendations on the report I'm asking about? I'm completely lost...
Thank you again.
|
|
|
|