|
Hello all,
I’m trying to develop a simple/personal firewall using C#. I used Jesus O’s class for setting the rules and it is working smoothly. However, I’m trying to search for a way to make the application ask the user if a certain program is trying to access the internet, showing the port, address, direction…etc (just like the popup dialog in ZoneAlarm). I’m not even sure if this is the right place to ask, but any hint on how to do it, implement it, the algorithm for it or the API would be highly appreciated.
Many thanks in advance,
tmp0
|
|
|
|
|
I want to make a programm for checking commentinformation (like summary, param, remarks ans so on) with the real code.
My Problem is who can i read out this information?
In Visual-Studio i can see this in object-explorer an by autointilsence. But who can i get it.
Can anybody help me?
|
|
|
|
|
|
Okay, but who can i do this.
I Want read out the information about class,properties, methods an so on with reflection.
But i see no way to bring together the both information parts.
|
|
|
|
|
Good morning,
I would like to use Microsoft projct 2000 with C#. I have already added the necessary references but I don't know what to include as namespaces to open a *.mpp file or access to saved data.
Some code lignes would be helpfull for me.
Thanks for help.
|
|
|
|
|
My problem is, i have migrated from VB.net to C# recently. In vb.net, in the code window's left combo box we get the list of controls and in the right combobox we get the list of events associated with the selected control in the left combobox. And when we select an event from the combobox list vb.net writes the declaration for that event. But in C# i am finding difficulty in writing events by my own. I know how can we add events in C#, like, we have to go to windows designer code and write a new eventhandler like : this.button1.KeyDown += new System.EventHandler(this.button1_KeyDown);
and then i have to go to my forms code window (i m using .net 2005) and write a method there with name "button1_Keydown". But my problem is i dont know what arguments i have to pass in this method. In vb.net the designer itself write the method with arguments for me so i dont have to worry about what are the event's arguments.
Please help me how can i get the list of events with its arguments associated with a controls.
Thansks in advance .
sheel
|
|
|
|
|
In the designer select the control you want an event for. In the property grid switch to "events" and double click the event you want to implement.
|
|
|
|
|
Many thanks to you my friend. You solved my big problem.
Happy Coding
Sheel
sheel
|
|
|
|
|
Though personally i think this approach is perfect (and i admit using it often)... but I'd hate to rely on the UI designer for the control events and such. Most of the times, for the sake of clealiness, I myself associate the events manually. And the C# IDE has a great intellisense for events. As soon as you type "MyControl.Event+=" .. simply press "Tab" twice and it'll do the job.
- Malhar
|
|
|
|
|
I am just starting out in C# and find my self stuck on a problem that looks to me to be a permission problem within my application. Any suggesions on where I should create the instance so both forms can access it?
I am tring to have a single instance of a class be accessable within multible forms.
Dumb version of what Im doing
NameSpace – App
{
Class Testing class
{ create an array of int's}
Form1
{
- Create instance of Testing class
}
Form2
{
- Access class created in Form1 !! ERRROR, I not see the instance..
}
}
|
|
|
|
|
Hi,
Implement your class as a Singleton?
So....
==================
using System;
namespace MyApp
{
public class MyClass
{
private static MyClass myClass;
//Make the constructor private instead of public.
private MyClass(){}
//Call this method to return the same instance to all.
public static MyClass GetInstance()
{
if (myClass == null)
{
myClass = new MyClass();
}
return myClass;
}
}
}
==================
|
|
|
|
|
Hi,
How can I write a timer function in C#, so that the timer
can register the datetime (but not the interval) of the event ?
And if my timer program sleep as the PC sleep while the user away,
how can I alert the timer to re-check the scheduled event to see if
there are any events that is over-due ? (i.e. is there are any
event handling for watching the PC system awaking from sleep ?)
Thanks
|
|
|
|
|
ChristmasTree wrote:
How can I write a timer function in C#, so that the timer
can register the datetime (but not the interval) of the event ?
You can't. The best you can do is to write a frequent timer that checks the date/time to see if it has passed.
ChristmasTree wrote:
And if my timer program sleep as the PC sleep while the user away,
how can I alert the timer to re-check the scheduled event to see if
there are any events that is over-due ? (i.e. is there are any
event handling for watching the PC system awaking from sleep ?)
Same as above - check the time regularly, and if it has passed, then act. It won't matter then if it's passed by 1/2 second, or by 20 years.
<edit>
Of course, Windows HAS a scheduler, I don't know much about it, but I presume you can schedule your own task there, but I take it to mean you want to do something entirely in code within your existing program.
</edit>
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Why c# programs don't run on PCs where there's no a setuped visual studio ????
i tried to run a c# executable file on a pc where there was no setuped visual studio, and i was surprised when the error message appeared.
Don't Smile To The World...It Does Not Smile To You
|
|
|
|
|
comingsoon wrote:
Why c# programs don't run on PCs where there's no a setuped visual studio ????
i tried to run a c# executable file on a pc where there was no setuped visual studio, and i was surprised when the error message appeared.
I'm astounded how many people use the .NET framework and have absolutely no idea how it works.
C# and VB.NET programs compile to an intermediate language called MSIL. The .NET framework installer runs as part of the VS install, obviously. Anyone who wants to run your C# executable needs to also have the .NET framework installed. If you don't want that requirement, use C++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Is there any other solution 4 that prob ?
where can i find the .NET framework ???
Thanks for reply, Christian
Good is Good
|
|
|
|
|
comingsoon wrote:
Is there any other solution 4 that prob ?
No, your options are C++ and the .NET framework. If there was any other option, why would anyone download the framework to start with ?
comingsoon wrote:
where can i find the .NET framework ???
Choose[^] any of the hits I got from google, I'm sure at least the first four will give you a download link.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Isn't it also astounding how many people don't know how to use the Internet, or more specifically, a search engine?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yeah, that's also a good point.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Hi,
what is the most proper right to create a synchronized arrayList
that can allow different threads to access it ?
Thanks
|
|
|
|
|
|
All,
Just wondering if it is possible to parse XML from a string in memory, as opposed to a file? I'm getting XML data over a TCP/IP connection, and it is read into a string in memory. I could dump the string to a file, then parse the filename to XmlTextReader, but that seems like a waste of resources.
Any pointers would be appreciated.
Cheers,
Andrew
|
|
|
|
|
Hi Andrew,
there are some solutions:
1st)
If you only want an XmlDocument, use the methode LoadXml of the XmlDocument class.
<br />
string myXmlContent = @"<GoodSides><Side name='CodeProject'>http://www.codeproject.com</Side></GoodSides>";<br />
XmlDocument xmlDoc = new XmlDocument();<br />
xmlDoc.LoadXml(myXmlContent);<br />
2nd)
Copy the bytes (or strings) to a MemoryStream.
<br />
byte[] myContent = ...;<br />
MemoryStream memStream = new MemoryStream(myContent);<br />
XmlTextReader xmlReader = new XmlTextReader(memStream);<br />
or
<br />
MemoryStream memStream = new MemoryStream();<br />
StreamWriter memWriter = new StreamWriter(memStream);<br />
memWriter.Write(@"<GoodSides>");<br />
memWriter.Write(@"<Side name='CodeProject'>http://www.codeproject.com</Side>");<br />
memWriter.Write(@"</GoodSides>");<br />
memStream.Position = 0;
XmlTextReader xmlReader = new XmlTextReader(memStream);<br />
3rd)
Implement a own class with Stream as BaseClass.
This class can read the datas direct from TCP/IP.
<br />
class MyOwnStream: Stream<br />
{<br />
int Read(byte[] buffer, int offset, int count)<br />
{<br />
...<br />
}<br />
};<br />
MyOwnStream myStream = new MyOwnStream(...);<br />
XmlTextReader xmlReader = new XmlTextReader(myStream);<br />
4th)
Use the SocketStream direct. (If the stream contains only the xml data and no more.)
<br />
NetworkStream myNetworkStream = new NetworkStream(mySocket);<br />
XmlTextReader xmlReader = new XmlTextReader(myStream);<br />
Hope, it helps
Niedzi
|
|
|
|
|
how can I get message I want in a textbox after checking a chekbox?
|
|
|
|