|
Yes , true , but no events are fired and .Document property is always null. that means that the webbrwoser needs to be run in some other way that i don't know.
|
|
|
|
|
so you are doing something wrong.
You do know Navigate() is an asynchronous call, the document is available only after the DocumentCompleted event has fired?
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
What is stopping you from using WebBrowser control without dragging it onto a form ?
You can always do something like:
void DoStuff() {
WebBrowser wb = new WebBrowser();
wb.Navigate(".......");
}
|
|
|
|
|
well , it doesn't work this way because the method Navigate is asynchronous and i need to have events fired like DocumentCompleted and others. I noticed that no events are fired when i don't host the WebBrowser control in a form .
|
|
|
|
|
It is because you have not subscribed to those events. Declare the WebBrowser control at the class level and subscribe to its events.
class MyClass {
WebBrowser webBrowser1 = new WebBrowser();
MyClass() {
webBrowser1.DocumentCompleted += EventHandler(...);
}
}
|
|
|
|
|
You also need to realize that a Form is nothing but a class (System.Windows.Forms.Form). When you put your control on a Form, the VS designer writes so much boilerplate code for you. When you don't use a form to host your controls, you need to write that code yourself.
The easiest way to learn is to put your control on a form, set its properties, create event handlers and investigate the code it creates for you. Specifically look at the designer generated code in the Form1.designer.cs (or so) file.
|
|
|
|
|
What II have is a small server that I been playing a round with. It's just that I can connect to it and that's about it. I been trying to do is get it so I can log and go to a menu and well doesn't look like I can get my answer from some of the other places.
So I thought I would try here. Can some one please help me set this up.
the code is below.
<br />
<br />
static void Main(string[] args)<br />
{<br />
int recv;<br />
byte[] data = new byte[1024];<br />
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 1605);<br />
<br />
Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);<br />
<br />
newsock.Bind(ipep);<br />
newsock.Listen(10);<br />
Console.WriteLine("Waiting for a client...");<br />
Socket client = newsock.Accept();<br />
IPEndPoint clientep = (IPEndPoint)client.RemoteEndPoint;<br />
Console.WriteLine("Connected with {0} at port {1}", clientep.Address, clientep.Port);<br />
<br />
<br />
string welcome = "Welcome to my TCP server (© 2008)";<br />
data = Encoding.ASCII.GetBytes(welcome);<br />
client.Send(data, data.Length, SocketFlags.None);<br />
<br />
<br />
<br />
do<br />
{<br />
string menu = "L)ogin Q)uit V)iew Log";<br />
data = Encoding.ASCII.GetBytes(menu);<br />
client.Send(data, data.Length, SocketFlags.None);<br />
<br />
string choice = "Command : ";<br />
data = Encoding.ASCII.GetBytes(choice);<br />
client.Send(data, data.Length, SocketFlags.None);<br />
<br />
switch (choice.ToUpper())<br />
{<br />
case "Q":<br />
<br />
break;<br />
case "L":<br />
Login();<br />
break;<br />
case "V":<br />
break;<br />
<br />
default:<br />
string NotThere = "Wrong Choice";<br />
data = Encoding.ASCII.GetBytes(NotThere);<br />
client.Send(data, data.Length, SocketFlags.None);<br />
break;<br />
<br />
}<br />
<br />
} while (choice != "Q");<br />
<br />
<br />
<br />
while (true)<br />
{<br />
data = new byte[1024];<br />
recv = client.Receive(data);<br />
if (recv == 0)<br />
break;<br />
<br />
Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv));<br />
client.Send(data, recv, SocketFlags.None);<br />
}<br />
Console.WriteLine("Disconnected from {0}", clientep.Address);<br />
client.Close();<br />
newsock.Close();<br />
}<br />
<br />
public static void MainMenu()<br />
{<br />
<br />
}<br />
<br />
public static void Login()<br />
{<br />
<br />
}<br />
<br />
}<br />
|
|
|
|
|
bigjoe11a wrote: I been trying to do is get it so I can log and go to a menu
Would you please rephrase this, what are you trying to do?
|
|
|
|
|
What I want to do. Is log in and have a menu with choices. The only thing I could do with this server is connect and thats it.
I wanted en option that when I connected to the server. I could log in and it would take me to a menu. Then I could do some thing or log off.
Sorry I been up late nights so my typing may not be all that great.
Joe
|
|
|
|
|
Your menu would have to be on your client and then your client would forward the command to your server.
|
|
|
|
|
Ok, so would you need my client source code to show me how to do that or what do you need.
|
|
|
|
|
No, I've already told you what to do.
Try it and let me know where you have problems.
|
|
|
|
|
LOL. Right. If I new how to do that I wouldn't have posted a message asking for help.
|
|
|
|
|
Hi all,
I'm trying to display the tooltip by calling "ToolTip.Show(String, IWin32Window, Point)", but I wanted to do it like what Windows explorer does - displays the tooltip at the lower left corner of the cursor.
I could get the mouse position by "MousePosition", but how could I get its lower left corner position?
Thanks,
|
|
|
|
|
You'd have to get the current cursor icon and work out where inside it is the point that corresponds to the mouse 'position'.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
Most cursors have a size of (32,32); there is SystemInformation.CursorSize, but AFAIK that is a constant, it does not depend on current cursor, and active window.
So the easiest thing to do would be to adjust MousePosition by (0,32).
BTW: most cursors have their hotspot at (0,0); when this changes, you might want to take that in account too...
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Thanks for the replies.
It seemed “Cursor.Size.Height” could be used。
|
|
|
|
|
I wanna check if string in textbox is in good format. Lets say you must put name of file without extension before you press button for creation. So it must be like filename and not filename.extension
Thanks,
Bye
|
|
|
|
|
You can validate a format with regex.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I used savefiledialog instead.
Thanks anyway
|
|
|
|
|
how would i query AD for all user's in a group (note i have 2400 users in the group i want to quesy)
in Csharp
|
|
|
|
|
Use System.DirectoryServices
If you do a google search on this, there are some good examples.
|
|
|
|
|
Hi,
How to generate a proxy class from WSDL by not generating classes for known types ?
I already have few classes which WSDL has and i don't want WSDL tool to generate partial classes for those client classes which i have in xyz namespace.
Thanks
|
|
|
|
|
I found the solution. I commented out all the shared types from proxy class (generated by wsdl) and added [XmlInclude] attribute on proxy class for all types in shared assembly. I am not sure its the right approach.
|
|
|
|
|
The WSDL tool has a command line switch to reuse classes from specifed assemblies instead of creating new ones. You can specify your assembly there. I don't know the exact switch though
|
|
|
|