Hi,

im very new to programming. I was just wondering if anyone can help me code a simple program that opens up a few instances of internet explorer when i type a certain symbol (of a stock) in to a text box

For example, if the symbol of a stock is 'msft' , i want to be able to type that into a text box, press a button, and 5-6 different sites would open up.

one site would be: http://stockcharts.com/h-sc/ui?s=msft

second would be:http://www.stockhouse.com/comp_info.asp?symbol=MSFT&table=LIST

and so on

I have access to visual studio 2005, which is why im posting in the C# section.

Thanks in advance for any help

PS: can anyone recommend any good books to learn C#?

Recommended Answers

All 4 Replies

The following is vbs, so it just needs to be written into notepad and saved with a .vbs extension. I don't know if c/c++ can run vbs scripts, but if it must be c/c++ it wouldn't be too hard to port over.

dim WshShell
dim searchString

searchString= InputBox("Please enter the Search Criteria", "Search...")

if (StrComp(searchString, "")) = 1 then
    Set WshShell= WScript.CreateObject("WScript.Shell")
    WshShell.Run "iexplore http://stockcharts.com/h-sc/ui?s=" & searchString & "", 1
    WshShell.Run "iexplore http://www.stockhouse.com/comp_info.asp?symbol=" & searchString & "&table=LIST", 1

end if

Just add one WshShell.Run line for each location you want opened.

You can open up a link in C# by using the start function in the System.Diagnostics.Process object. For example:

System.Diagnostics.Process.Start("http://stockcharts.com/h-sc/ui?s=msft");

This will run your stockCharts.com link in your default browser.
Its a pretty simplistic solution. I hope that is what your looking for.

Hi, i should have posted earlier that i've managed to solve this. i was looking to open a new window each time. using system.diagnostics.start(.....); it opened the site in the same window over and over.

here's what i had

Process p = new Process();
p.StartInfo.FileName = "iexplore.exe";
p.StartInfo.Arguments = "http://www.nameofsite.com/";
p.Start();

Thats really cool.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.