|
How is the function for block website that have been enter in text box and click add button it will appear in listbox. All this is in one form only.And another button for remove the web site have been add in listbox. The web site have been block will block by browser and this web site cant be acess. Please help me.Thanks A lot.
Below are the coding for the web site bloking form:
//List box
private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
{
}
//TextBox
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
//Add button
private void Add_Click(object sender, EventArgs e)
{
}
//Remove
private void Remove_Click(object sender, EventArgs e)
{
}
Tq...
|
|
|
|
|
I writing an windows app in C# that receives data via serial port.
I have a thread dedicated to reading from the serial port and when
it has a full packet, it makes a call to the main form.
CallBackUpdate callBack = new CallBackUpdate(updateState);<br />
Invoke(callBack, new object[] { newPacket });<br />
So it passes the newPacket to a method called updateState.
Lets say this happens: (Although I don't think it will)
1.Receive one packet and is sent to main form for processing.
2.Receive another packet and send it to main form before packet from 1 is done processing.
Question/Concern
Will the main form process the first packet completely before it processes the second?
or
Do I have to add some blocking to the serial thread so that it doesn't send a packet for
processing when another is being processed.
|
|
|
|
|
dino2094 wrote: Invoke(callBack, new object[] { newPacket });
Careful here. This will block until the Form invokes the delegate and it completes. Your serial port thread won't be able to do anything else. Perhaps try BeginInvoke instead.
dino2094 wrote: Will the main form process the first packet completely before it processes the second?
Yes.
dino2094 wrote: Do I have to add some blocking to the serial thread so that it doesn't send a packet for
processing when another is being processed.
Well, you get that for free by using Invoke rather than BeginInvoke. But I'm betting you'd probably want to use BeginInvoke instead.
|
|
|
|
|
Program type: preferably windows service
Program Description
Part 1: polls sql table for recs with certain criteria (needs to check every minute or so)
Part 2: If part 1 finds recs that match, then part 2 needs to retrieve those records and do some work to them. (convert the records data into a xml document)
Part 3: The newly created xml document needs posted to a clients website (which gives a response of an error code or confirmation #)
Part 4: The original sql record needs updated with the confirmation and a flag signifying the task is done.
I am having problems figuring out how this should be done.. for instance if part 1 is checking every minute by using a timer if parts 2 - 4 haven't completed after part 1 has notified them the first time it might try to notify about the same records again
How would you keep everything organized
|
|
|
|
|
Mischievious wrote: I am having problems figuring out how this should be done.. for instance if part 1 is checking every minute by using a timer if parts 2 - 4 haven't completed after part 1 has notified them the first time it might try to notify about the same records again
Stop the timer after a match has been found. Restart it after completing part 4.
|
|
|
|
|
Thanks Leslie,
I guess that would be the logical thing to do. For some reason I was thinking that I needed to keep the polling part running while I was processing the records.
Thank you again for your help.
|
|
|
|
|
I am working on a project to encode videos by WMEncoder and having a problem.
If a video has no sound at all, then audio source shouldnt be created and added into group:
IWMEncSource SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
SrcAud.SetInput("C:\\Inputfile.mpg", "", "");
But how to figure out if a video has sound or not?
The other question is how to cut thumbnail from a video by WMEncoder or WMFormat? I didnt see any samples.
Thanks!
|
|
|
|
|
I need to store configuration data in a single file and allow several projects to use this one file. For example:
<projects>
<project_one>
<authorname>Some name</authorname>
<projectname>some name</projectname>
<fullpath>D:\My Projects\Projectname1</fullpath>
<date>Date</date>
<param_one>some parameter</param_one>
</project_one>
<project_two>
<authorname>Some name</authorname>
<projectname>some name</projectname>
<fullpath>D:\My Projects\Projectname2</fullpath>
<date>Date</date>
<param_one>some parameter</param_one>
</project_two>
</projects>
I am confused about which class to use XmlTextReader/XmlTextWriter or XmlDocument? I simply need to append new project nodes, delete old ones, and retreive the data when necessary.
Thanks,
Mark
|
|
|
|
|
I think all your requierments can be fullfiled using XmlDocument Class[^]
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
<br />
<span style="color: #0000FF;">public static</span> Bitmap BytesToBmp( <span style="color: #0000FF;">byte</span>[] b, <span style="color: color: #00CC99;">Size</span> imageSize )<br />
{<br />
<div style="padding-left: 5px;"><br />
<span style="color: #009933;">
</div><br />
<div style="padding-left: 5px;"><br />
<span style="color: color: #00CC99;">MemoryStream</span> stream = <span style="color: #0000FF;">new</span> <span style="color: color: #00CC99;">MemoryStream</span>( b, <span style="color: #0000FF;">true</span> ); <br />
</div><br />
<div style="padding-left: 5px;"><br />
stream.Write( b, 0, b.Length ); <br />
</div><br />
<div style="padding-left: 5px;"><br />
<span style="color: #009933;">
</div><br />
<div style="padding-left: 5px;"><br />
<span style="color: color: #00CC99;">Bitmap</span> bmp = <span style="color: #0000FF;">new</span> <span style="color: color: #00CC99;">Bitmap</span>( stream ); <br />
</div><br />
<div style="padding-left: 5px;"><br />
stream.Close(); <br />
</div><br />
<div style="padding-left: 5px;"><br />
bmp = <span style="color: #0000FF;">null</span>; <br />
</div><br />
<div style="padding-left: 5px;"><br />
<span style="color: #0000FF;">return new</span> <span style="color: color: #00CC99;">Bitmap</span>( bmp, imageSize ); <br />
</div><br />
}<br />
I'm getting an error: System.ArgumentException: Parameter is not valid.
Then when I use the Stream Object I get:
Cannot create an instance of the abstract class or interface 'System.IO.Stream'.
I'm at a lose on how to create a Bitmap from a Stream if I can not create a Stream.
I was under the impression that a derived class such as: MemoryStream would work.
Any help explaining this would be helpful.
Thanks.
I'm listening but I only speak GEEK.
|
|
|
|
|
I did something like this the other day, using the static Bitmap.FromStream() method. Here's my code - my bitmap was encoded in a string...
<br />
MemoryStream ms = new MemoryStream( Convert.FromBase64String( eImage.InnerText ) );<br />
Bitmap bmp = Bitmap.FromStream( ms ) as Bitmap;<br />
Why do you stream.Write()? Isn't the data already in the MemoryStream from the constructor?
I also don't understand why you set bmp = null, or what the purpose of constructing a new Bitmap on return.
|
|
|
|
|
Nick Hodapp wrote: Why do you stream.Write()?
Basiclly this is the first time I'd used it and based of examples I'd found, I thought I need to perform the write to prepare the stream.
Nick Hodapp wrote: I also don't understand why you set bmp = null
I'll be calling this method hundreds of times with ASP.NET and will need to make sure that Garbage Collector knows I'm done with the variable.
I'm still getting the same error message[^]. I've added a link to a screen shot of the error message. Thanks for your help.
I'm listening but I only speak GEEK.
|
|
|
|
|
Parts of your code are a mess. Also, you don't say where the errors occurred - this is important and I cannot guess where.
Lets examine the code:
MemoryStream stream = new MemoryStream( b, true );
stream.Write( b, 0, b.Length );
I'm not sure about your thought processes here. You create a MemoryStream using the contents of the buffer, b, which contains the data. Then you write the contents of b into the stream. But the stream already contains the contents of b. I suggest that the Write operation is redundant.
Bitmap bmp = new Bitmap( stream );
stream.Close();
This seems reasonable.
bmp = null;
return new Bitmap( bmp, imageSize );
I am curious as to what you think this actually does. I don't mean to be unkind, but I really don't understand your thought process.
The following would seem to be a good way forward:
using(MemoryStream ms = new MemoryStream(b))
{
Bitmap bmp = new Bitmap(ms);
return bmp;
}
|
|
|
|
|
Colin Angus Mackay wrote: Also, you don't say where the errors occurred
Error Message[^]
Understanding the logic behind the MemoryStream basiclly this is the first time I'd used it and based of examples I'd found, I thought I need to perform the write to prepare the stream.
I'm still getting the same error message. I've added a link to a screen shot of the error message. Thanks for your help.
I'm listening but I only speak GEEK.
|
|
|
|
|
Thank you every one for your help.
public static Bitmap BytesToBmp( byte[] b )
{
using ( MemoryStream ms = new MemoryStream(b , true) )
{
Bitmap bmp = Bitmap.FromStream( ms ) as Bitmap;
return bmp;
}
}
Works great. This is was the byte[] that I was sending the method; it was not being recognized by the Bitmap Constructor. I am storing images within an Access 2003 db, (yes, not a good idea), and the way Access had been altering the byte [] so that the Bitmap Constructor couldn't recreate it. I'm not sure n exaclty what Access was doing with the Image but I as inserting a bitmap from file to it. ???
If anyone know the answer to this, please drop me a line. Otherwise, I'm now converting the image and inserting it into the database using a FileStream in and then a FileStream out. If anyone is interested I will post the project when I've completed.
Thanks again!!
I'm listening but I only speak GEEK.
|
|
|
|
|
'Adaptive Resonance Theory'
ART network is a 'Neural network'.
the goal is design an Art with C#,
because Matlab not supprt Art netwok.
in the network is a parameter than named vigilance factor
this factor to care network in front of learned pattern
|
|
|
|
|
Interesting. Do you have a concrete question too or are you simply expecting us to write the whole thing for you?
In case you're looking for some ideas on how to implement neural networks in C#, search the articles. There are some covering the topic.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
hello... i wanted to segment a picture into characters using histograms... i managed to do so but now the code throws exception "image already locked"...
this exception is not thrown all the time but is thrown sometime... i think it is because image although is unlocked (i did unlocking) according to statement but the area might still be captured in ram or so... plz correct me if i am wrong and also show me some way to control the exception as it occurs at times and not all the time....
please provide help
and are there any algos for character segmentation apart from histogram and connected components one... which will work better...
haseeb
|
|
|
|
|
Hi!
i have a problem!
i have a datagrid and when the focu is on it and click on enter, the focu pass to the next row. How i do to take off it! I'd like to disable it to not pass to the next row.
help me!!
Thanks
|
|
|
|
|
Hi,
You could code the following
<br />
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)<br />
{<br />
if (e.KeyCode == Keys.Enter)<br />
e.Handled = true;<br />
}
Hopes this helps...
Greetings
Kaine
|
|
|
|
|
Thanks for help me!
this code was great, it helped a lot.
if (e.KeyCode == Keys.Enter)
e.Handled = true;
Thanks again!!
|
|
|
|
|
Hi, I have a question related to reporting.
Right now I'm trying it with Crystal Reports, but I'm open to other suggestions. I need to make some letters generated from a customer file in a MySQL DB.
The letters would involve some fixed text, some variable field in and under the text.
What are the best ways to generate reports for MS Word or in PDF when I have a class that looks like this f.e.:
Rappel
- customerName
- customerStreet
- customerPostal
- quantityBehindOnPayment
- comments
or little more complex
Invoice
- customerName
- customerStreet
- customerPostal
- customerCode
- InvoiceLines (list)
- total
- comments
If the answer is going to be "use Crystal Reports", can anyone direct me towards a decent tutorial, example or anything for using this kind of reports? Because I'm kind of struggling. Thanks in advance.
The output can be anything as long as its printable (.doc, .pdf, .html,...)
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Good evening everyone,
I'm trying to write to an existing file using the StreamWriter and I cant replace the entire text in an existing file.. for example if I wrote xxx to file already contains oooo, the result will be xxxo
Please help
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
You don't really have a choice here. You read the file, modify the contents how you want in memory, then write it back out.
The only opther way to do it would be to treat the file as Binary, not Text and start modifying the individual bytes of the file. But then you'll also have to worry about encoding and Unicode (multi-byte characters).
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave, you're really a MVP, at least to me
Pleased to meet you and thank you for your true help every time.
ps. I liked the first tip and will use it, thanks again Dave
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|