|
If you see the "Main" method, it looks like this :
static void Main(string[] args)
You get the directory in "args".
Just use args[0] and args[1]
|
|
|
|
|
Hi,
kindly let me know, How may I change back color in LISTBOX of any particular item or index ?
Thank you
(Riaz)
|
|
|
|
|
You can do that by handling DrawItem event of the ListBox. Make sure you set the DrawMode as OwnerDrawFixed or OwnerDrawVariable as per your needs.
|
|
|
|
|
|
I want to draw a graph similar to microsoft project plan which shows tasks (start & completion date for each task) and dependency like if start of any task is dependent on completion of other tasks.
To start with i need some guidance. I searched in google and i found ZedGraph but it does not solve my requirement. Please help
|
|
|
|
|
If you look at the source code for zedGraph, that may help a lot. Basically you handle a paint event and you write code to draw your graph.
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.
|
|
|
|
|
|
Just like DrawLines can draw hundreds of thousands of lines at once, hell lot better performance than going through loop and drawing each individual line.
I want something similar for ellipse as well..Going through loop is making my app really sluggish..
Pl help
|
|
|
|
|
Unlike Graphics.DrawLines, there is no equivilent DrawEllipses. You have no choice but to loop through each ellipse you want to draw.
|
|
|
|
|
I'm working on windows application.I need to find out the number of bold letters available in the Word document.
I have used name space Microsoft.Office.Interop.Word to read the word document and also tried with some of the properties like Selection,Range to find whether the character is in bold or not but no result.
I have read each character by reading the content of document and checking its format but here while reading the text the character is missing its Format.
I have also tried by converting it into html format and tried by using HTML Element Collection but it is unable to read/recognize the bold tag.
Please give the solution to count the bold letters of word document.
Thanks
|
|
|
|
|
This[^] wasn't good enough?
|
|
|
|
|
My application has a WebBrowser object
Inside a WebBrowser object i navigate to google site and from there a want to type something in the textbox and then press search button
how can i achieve that? can anyone check this code?
WebBrowser_Main.Navigate("http://www.google.com/");
while (WebBrowser_Main.IsBusy == true)
{
Application.DoEvents();
}
HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument)WebBrowser_Main.Document;
HTMLInputElement otxtSearchBox = (HTMLInputElement)myDoc.all.item("q", 0);
otxtSearchBox.value = "code project";
HTMLInputElement btnSearch = (HTMLInputElement)myDoc.all.item("btnI", 0);
btnSearch.click();
thanks
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
You're going about it all wrong. If you want to add search capabilities to your own site or app, use the search API Google provides, here[^].
|
|
|
|
|
i understand what you said, but i don´t want to do that
google is a exemple, i what to login to one site using that type of code
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
I don't do screen scraping of web pages - it's just too inefficient for me...
So what's not going right with the code you posted??
|
|
|
|
|
" Cannot convert type 'System.Windows.Forms.HtmlDocument' to 'mshtml.HTMLDocument' "
it for a browsergame bots, i need to see the bot work
i got the code from a project here but it uses a AxSHDocVw.AxWebBrowser and assemblers shdocvw and axshdocvw, i think is from old version
for course if a change the project code it works
i want do changes in code in order it to work in webbrowser object (not in AxSHDocVw.AxWebBrowser)
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
|
solved
i will use that axbrowser intead, i add to tools
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hello guys!
I'm writing my first network based application in order to learn yet a little more about the C# programming language. And I've been up for hours now working on this program that works, to about 99%. But I want this extra feature that helps me when beta testing it. It's a server / client application that simply connects using sockets and IP addresses. I found it to be the best starting point since it's really basic.
So, the problem I have is that I made a "preloader" for my program, when the server starts it directly tries to establish a connection to my IP in order to send the servers IP address to me. If I got my client up and running and I've choosen to scan for new connections then it works as intended. However, I only get 1 IP adress, the first line sent to me. I know why, I just dont know the best solution to get multiple lines recieved.
Posting a small example so that you guys might be able to help me out on this one.
private void b3_Click(object sender, EventArgs e)
{
try
{
string serverIP = "";
TcpListener tcpListener2 = new TcpListener(1235);
tcpListener2.Start();
Socket socketfromServer = tcpListener2.AcceptSocket();
networkStream2 = new NetworkStream(socketfromServer);
streamReader2 = new StreamReader(networkStream2);
streamWriter2 = new StreamWriter(networkStream2);
serverIP = streamReader2.ReadLine();
t3.Text = serverIP;
}
catch (Exception xx)
{
MessageBox.Show(xx.ToString());
}
}
The server uses a For loop and if more IP addresses then one are found, then it will use WriteLine to post them one after another until they are all sent. With this usage, I got 1x ReadLine(), and thus I only get the first line sent from the server. So, how do I get multiple lines in a smart way? ^^
|
|
|
|
|
noiser wrote: serverIP = streamReader2.ReadLine();
Will only ever read one line ya know!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Yes, I know. That's why I'm wondering what other function to use or how use the readline to get multiple lines of data.
|
|
|
|
|
how about:
string line;
while((line = streamRead.ReadLine()) != null)
{
// do something
}
or
string text = streamReader.ReadToEnd()
However all those method have problem when reading from a socket where the flow of data is potentially unpredictable (although, I believe, a TCP packet is at least 255 user bytes long and guaranteed to arrive in one burst)
So it's why over the wire communication protocol makes heavy use of header fields!
I would be you, the simplest thing I would do is
// server
var br = new BinaryWriter(outsream);
br.Write(numString);
for(int i=0; i<numstring; i++)="" br.write(strings[i]);
on="" the="" server="" side
var="" br="new" binaryreader(instream);
int="" n="br.ReadInt32();
for(int" i="0;" i<n;="" list.add(br.readstring());
and="" that's="" simplest="" one!
i="" might="" do="" some="" more="" sophisticated="" header...
and="" better="" exception="" handing="" of="" course!="" =""
<div="" class="ForumSig">A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Ey thanks man! This is a much better answear then the first one.
I'll be trying these methods out.
|
|
|
|
|
Cool!
Good luck with that!
Yeah, sometimes I feel cheeky with questions and answers...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
I fixed the problem. ^^
Using this code block dosn't work. Apparently it gets stuck on reading the last line even though it should be empty.
string line;
while((line = streamRead.ReadLine()) != null)
{
}
So what I did was this:
while ((serverIP = streamReader.ReadLine()) != "EOF")
{
ipBuffer += serverIP + "\n";
serverIP = "";
}
On my server application whenever I am done sending data I send a line with the text "EOF" and thus I can break the infinite loop. :P
|
|
|
|