|
Just try to recursion.
private void GetControl(Control mainControl)
{
foreach(Control control in mainControl.Controls)
{
//Do something
if(control.Controls != null)
GetControl(control)
}
}
I hope this works!
Tom
|
|
|
|
|
I thought that I could do it with recursion...
I was confused by a different types of controls that could be in win forms, but I didn't realised that all controls are type of Control...
Silly me .
Thank you..
-- modified at 17:34 Friday 15th September, 2006
|
|
|
|
|
Hi,
I'am working on a Kid safe application from Internet's improper content. I was handling the IEs navigated URLs with Webbrowser event handler. However, I am unable to handle the other browsers; Opera, Netscape etc.
Is there any way to listen port 80 of XP. Because, with that way if any incoming http content arrived the port 80, and if it's not IE, I can end task of the process that uses port 80. I need to detect of port 80's usage in runtime. For any idea or help, I would be grateful.
Thanks in advance
Allen
|
|
|
|
|
You could do this:
IPAddress ipAddress = Dns.Resolve(Dns.GetHostName()).AddressList[0];
IPEndPoint ipLocalEndPoint = new IPEndPoint(ipAddress, 80);
try{
TcpListener tcpListener = new TcpListener(ipLocalEndPoint);
tcpListener.Start();
}
catch ( Exception e ){
Console.WriteLine( e.ToString());
}
If it succeeds, then your listener is listening on Port 80
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I had tried that earlier:
<BGCOLOR="#CCCFCC"><br />
protected void SocketThread_1()<br />
{<br />
IPAddress ipAddress = Dns.Resolve(Dns.GetHostName()).AddressList[0];<br />
TcpListener tc1=new TcpListener(ipAddress,80);<br />
<br />
while(true)<br />
{<br />
tc1.Start();<br />
Socket so1=tc1.AcceptSocket();<br />
<br />
byte[] reading=new byte[1024];<br />
int dimension=so1.Receive(reading,reading.Length,0);<br />
string data=System.Text.Encoding.ASCII.GetString(reading);<br />
<br />
listBox6.Items.Add(data);<br />
<br />
<br />
}<br />
<br />
}
When you type in the adress bar of any browser //localip:80 there comes some data. However, when you type a URL adress, no any data is incoming. I don't know the reason.
Allen
-- modified at 7:59 Saturday 16th September, 2006
|
|
|
|
|
Hello everyone!
I'm trying to capsulate Data-Access from the Model using different classes and NHibernate.
The problem is the following...
Calling the Methods down to the Database are ok. But when the result should come back in 'this' (see the comments in the Appointment-Class) no data is given, though in the AppointmentData-Class (see comment there) I can see them!!
First on the Form the user triggers the Button3, therefore one Appointment with Id "1" should be read.
private void button3_Click(object sender, EventArgs e)
{
Appointment app = new Appointment();
app.GetItem("1");
}
Calling the GetItem-Method of the instance of the Class Appointment.
public void GetItem(String Id)
{
this.Id = Id;
AppointmentData appData = new AppointmentData();
appData.GetAppointment(this);
//when the method-call comes back 'this' is empty except the field Id
}
Calling the GetAppointment-Method of the instance of the Class AppointmentData.
public void GetAppointment(Appointment app)
{
ISession session = null;
String appId = app.Id;
try
{
//using NHibernate
session = factory.OpenSession();
app = (Appointment)session.Load(typeof(Appointment), appId);
//here app is filled with correct data
}
catch (Exception ex)
{
Console.Write(ex);
session.Disconnect();
// handle exception
}
}
Perhaps someone could be me a little bit. Sorry for my bad language!
If something is unclear, I can explain it more detailed.
Many thx
Jochen Schneider
|
|
|
|
|
app = (Appointment)session.Load(typeof(Appointment), appId);
This line assigns a new object to the app variable which doesn't reflect outside the method unless you use the ref keyword. You have differentiate between changes to the state of an object and assigning a completly new object. The first case would require no extra work as Appointment is a reference type, but the second case require use of ref keyword. Change the method signature and call as follows:
appData.GetAppointment(ref this);
public void GetAppointment(ref Appointment app)
That's how it generally works, but I'm not sure if it works if you pass in this . Maybe you have no other chance than making some refactoring which maybe isn't that bad cause in my opinion your code is a bit strange (creating an appointment that creates an appointmentdata which then loads an appointment).
"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
|
|
|
|
|
Hey all,
I am new to using C#'s windows.form so sorry if this seems too trivial.
I need to create a control ("LineControl") that draws a line with the two ends of the line bound to two other controls called "LinkerControl". If the LinkerControl at the end of the line is moved, the LineControl is automatically updated and redrawn to keep the LinkerControls linked. Can anyone help me with this? Thanks a lot!!!
Tom
|
|
|
|
|
Hi!
Your LineControl will have to have two properties to hold references to the 2 connected LinkerControl s. When one of these properties is set, you could add an event handler for a Moved or PositionChanged event your LinkerControl s provide (don't forget to remove previously attached event handlers, if any).
In this event handler you correct the position of your endpoint and Invalidate() your LineControl to let it redraw itself.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thx Mav for your reply. However, i am having trouble with the drawing part that links the LinkerControls together. How can i create an object draw a line that can be delete, repaint automatically when i restore the Form after minimizations, etc. I have read:
http://www.codeproject.com/csharp/drawingshape.asp
However, the drawing is global (I can draw onto outside of the Form's clientRectangle) and since its graphics, it is erased once a new object is over it.
I hope this clarifies my objective. Thanks!!
Tom
|
|
|
|
|
Anybody out there know where I could go to lookup the process used for contacting AD via the DirectorySearcher object?
What I am specifically looking for is what is used to send user password info across the wire.
I am trying to create a connection with a Winform app. My concern is if someone other than the logged on account tries to access AD he/she has to enter a password, which means that either the DirecorySearcher either changes the user info into a token for transport, encrypts it to the standard AD format for comparison against the AD db, or it sends it unencrypted where it gets encrypted at the server and then compared...
I've watched the net traffic of the DirectorySearcher and don't see anything (user info) in plain text, but didn't spend too much time trying to find it either. However I did see all the returned data from AD was ALL in plaintext, which is why i'm concerned about the securtiy of the user info.
Any info, links, or wisdom shared is much appreciated.
thankz,
string Beautiful;
Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful +" people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
Hi,
I am working on an installer application to install 2 COM components in the system32 directory. I had this implemented previously to install to a different directory (i.e. C:\sample\dll) and it worked fine. The setup app seems to crash though when I changed the path to C:\windows\system32. This is the error I receive...
System.Runtime.InteropServices.COMException (0x80110401) Errors occurred accessing one or more objects
I am guessing its a configuration problem?
Any help would be appreciated.
Thanks!
|
|
|
|
|
Hello.
I will try to explain better my problem.
I have one application 3-tier.
In Data tier i have a class Address(example).
In Business tier (exposed by webservices) I have two webservices that returns class Address.
In Client or Interface Tier i have one module aspx that makes management of addresses. But in this class i only can import Webservice1.Address or Webservice2.address. But i want import only class Address, and not webservice1.address and webservice2.address (in client this 2 address classes are not the same).
I could i do that.
Thank you.
António Dias
Thank you,
António Dias
António Dias
-- modified at 5:21 Saturday 16th September, 2006
|
|
|
|
|
acardeiradias wrote: But, Address object are exposed diferently to client. The client see Webservice1.Address and Webservice2.Address.
Could you explain that in more detail.? I don't understand your problem and as it seems no one else does.
"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
|
|
|
|
|
I modified my initial message and i hope that my question be more clear.
Someone could help.
|
|
|
|
|
I am getting a NaN on the right side of the following statement
costWithInsert = RowVectorOne[i] + m_InsertCost;
where
float[] RowVectorOne = new float[rows];
float costWithInsert;
float m_InsertCost;
The left side has regular values and the array is not out of bounds.
The strangest thing is that it happens completely randomly.
I would appreciate any help in locating the cause of this problem.
Thanks,
David
|
|
|
|
|
And how is this different from the same post you made about 20 minutes earlier?
only two letters away from being an asset
|
|
|
|
|
davidmakovoz wrote: I am getting a NaN on the right side of the following statement
costWithInsert = RowVectorOne[i] + m_InsertCost;
davidmakovoz wrote: The left side has regular values and the array is not out of bounds.
I suggest after mastering left and right, you only then move on to vectors...
|
|
|
|
|
Hello,
I have a form: Form1 that launches a bunch of modeless forms:
formTemp.Show()
When I am closing my Form1, I want to know if there are formTemps are still open.
How can I find that out?
Thank you.
|
|
|
|
|
Add your forms to the parent using the AddOwnedForms method or by setting the owner property of the child form. When the parent is closed, all of the child should also close.
only two letters away from being an asset
|
|
|
|
|
I did that.
tempForm.Show(this)
However, just because one of the forms is an MDIParent, it must be a TopLevel Control, so it's always on top of the main form Form1, and I don't want that. That's why if you don't set the owner property everything works the way I want, but then I can't use OwnedForms property on the Form1 anymore. Is there a way around it?
Thank you
|
|
|
|
|
Then you're left with maintaining a collection of the created forms on your own. Not a difficult leap.
only two letters away from being an asset
|
|
|
|
|
I guess that would be a good approach. Thank you.
|
|
|
|
|
Have you ever tried Google Notebook? After installing the software, it will add a button at the bottom-right corner of IE. Dose anybody know how to implement that ? Any reply is appreciated.
Thanks
R.Y.J
|
|
|
|
|