|
Hello!
I'd like to write a toolbar for internet explorer (like google toolbar, but more simple) in visual studio 2005.
Is there any way to write this toolbar with C#, or is it inpossible?
If it is possible, how can I start the development? (For example: which new project type should I choose? and so on)
If it is not possible with C#, how can I do it? (I have seen, that it can be done with C/C++ and ATL project, but I did not find a good tutorial, which shows it from the beginning of the work)
Thanks for helping me.
|
|
|
|
|
|
|
The article might be in purgatory because of incomplete code description but it does contain a brief code snippet, which is a significant guidance or as a starter tool.
|
|
|
|
|
Hi guys,
I'm kind of short in time, and i need a help regarding some search engine in my code.
So, i have this program which looks for files in the drive c, f.e. , and then shows me the information about this files.
Now the problem is, that the program shows me only the files that are in the directory i chose, but it doesnt looks for files in any sub-directory.
I was told that I need to use a recursion, but I am kind of short in knowledge of the way to do it..
Here is the code of the search i have:
private void button2_Click(object sender, System.EventArgs e)
{
System.IO.DirectoryInfo d = new DirectoryInfo("C:\\");
if(d.Exists ==true)
{
DirectoryInfo[] fiArr = d.GetDirectories();
foreach (DirectoryInfo fri in fiArr)
GetFiles(fri);
}
}
I was wondering if you could help me with this..
thanks ahead
|
|
|
|
|
You code should be:
private void button2_Click(object sender, System.EventArgs e) {
System.IO.DirectoryInfo d = new DirectoryInfo("C:\\");
GetAllFiles(d);
}
private void GetAllFiles(DirectoryInfo d);
{
if(d.Exists ==true)
{
DirectoryInfo[] fiArr = d.GetDirectories();
foreach (DirectoryInfo fri in fiArr)
{
GetFiles(fri);
//Here is the recursion
GetAllFiles(fri);
} //foreach
} //if
} //GetAllFiles
Hope that helps.
Ben
|
|
|
|
|
Hey,
Thanks for answering me, i really appreciate this
Now, I copied what you wrote but it seems to be some problems with running it.
I use bisual studio .net 2003, Can it be the reason for something to go wrong?
or is it something else?
thanks, once again..
|
|
|
|
|
Although I haven't checked the code, you are probably missing a Using directive at the top of your class.
Try adding this at the top of your class file:
using System.IO;
If this doesn't help, maybe you could post what error your getting.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
I guess I am assuming that you have written GetFiles(fri);
method. So if that method doesn't exist you need to write it. If you are still getting errors you will nedd to give us the errors you are getting so we have some clue to what the problem might be.
Ben
|
|
|
|
|
|
That error message seems to indicate that the private void GetAllFiles method is not within the class definiation. It needs to be inside of the {} for your page. If you are still having issues you might want to copy your code behind file in a post.
Ben
|
|
|
|
|
|
I've added a progress bar to my app and i'm trying to update it but the result is only 0 and then 100.
int t = int.Parse(textBox1.Text);<br />
double s = ((p/t)*100);<br />
progressBar1.Value = (int)s;<br />
t (textBox1) is how many times to do the operation.
p is the counter for how many times it has been done.
ive followed the program with breakpoints and s is always 0.0, even when p is 10 and t is 100 ((10/100)*100) = 10.
wtf? :\
|
|
|
|
|
Try this:
double s = p * 100 / t;
It doesn't matter what order you do divide and multiply on paper, you get the same result. However, if you divide by an int, you get an int and if it's < 1, it will round to an int, so the * 100 isn't doing what you'd hoped.
double t = double.Parse(textBox1.Text);
double s = ((p/t)*100);
or
int t = int.Parse(textBox1.Text);
double s = ((p/(double)t)*100);
would also work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I believe that you are a former VB programmer?
In VB the / operator is only a floating point operator, and the integer division operator is \. In C# the / operator is defined for both data types, so which one is used depends on the data you use it on.
The exact equivalent of p/t in VB would in C# be (double)p/(double(t), as VB would automatically convert the values to accommodate the operator.
---
single minded; short sighted; long gone;
|
|
|
|
|
Is there any reason to cast p to double ? I thought casting t to double is all that's needed here.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes, casting only one of the operands is the minimum required to make it work. That would decide what operator to use, so the other operator will also be cast to the same type. Whether it's done implicitly or explicitly, the generated code will be the same.
I prefer doing explicit casting in situations like this. It shows the intention of the code more clearly than if one relies on implicit conversions.
---
single minded; short sighted; long gone;
|
|
|
|
|
hi how do i get the output of a c program with csharp codes?i hav a c program which writes its outputs to a text file.. i want that output to be updated to a database through c itself or my csharp program could read that output directly somehow and save to database
aneef
|
|
|
|
|
Doesn't DllImport help you?
|
|
|
|
|
the c code im using doesnt hav a dll file..it compiles to an exe file..and besides im not much of a c developer im in to c#..ill read about dllimport as wel..thanx man
aneef
|
|
|
|
|
Can any body help me?
I have create window form using C#.There are two item that is textbox for user key in password and OK button to link new form.
What is the code to take user input in the text box.
What is the code to veryfied user input is correct with the real password. If correct link to another form and aotomaticlly close this form.If wrong automaticlly close this form.
TQ.....
|
|
|
|
|
No-oe can tell you, because we don't know where the password comes from. The best asumption is a database, in which case, a proc that returns true or false for a username/password pair is the best bet.
krajah1984 wrote: If correct link to another form and aotomaticlly close this form.If wrong automaticlly close this form.
Close(); will close a form. Is this form the main form of the app ? You could have issues here, also.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi
iam new in Tapi ,I want creat project that can Answer call and....
where I shoud Start?!!????
Can u Help
????
tanx
Mati
|
|
|
|
|
|
I have been learning C# Forms from Petzold book but it only illustrates Menu and not MenuStrip. I know how to add a separator for a Menu (new MenuItem("-")but I do not know how to add a separator for a MenuStrip. Does anyone know of a reference or can someone show me how?
// Menu items.
MenuStrip menu ;
ToolStripMenuItem menuFile ;
ToolStripMenuItem menuFileOpen ;
ToolStripMenuItem menuFileSave ;
ToolStripMenuItem menuFileSaveAs;
ToolStripMenuItem menuFileExit ;
ToolStripMenuItem menuHelp ;
ToolStripMenuItem menuHelpAbout ;
.
.
.
// Menus.
menu = new MenuStrip();
menuFile = new ToolStripMenuItem("&File" );
menuFileOpen = new ToolStripMenuItem("&Open..." , null, new EventHandler(MenuFileOpenOnClick ), Keys.Control | Keys.O);
menuFileSave = new ToolStripMenuItem("&Save" , null, new EventHandler(MenuFileSaveOnClick ), Keys.Control | Keys.S);
menuFileSaveAs = new ToolStripMenuItem("Sa&ve As..." , null, new EventHandler(MenuFileSaveAsOnClick), Keys.Control | Keys.V);
menuFileExit = new ToolStripMenuItem("&Exit" , null, new EventHandler(MenuFileExitOnClick ), Keys.Control | Keys.E);
menuHelp = new ToolStripMenuItem("&Help" );
menuHelpAbout = new ToolStripMenuItem("&About" , null, new EventHandler(MenuHelpAboutOnClick ), Keys.Control | Keys.A);
// Add items to the main menu.
menu.Items.Add(menuFile);
menuFile.DropDownItems.Add(menuFileOpen );
menuFile.DropDownItems.Add(menuFileSave );
menuFile.DropDownItems.Add(menuFileSaveAs);
menuFile.DropDownItems.Add(menuFileExit );
menu.Items.Add(menuHelp);
menuHelp.DropDownItems.Add(menuHelpAbout );
// Add the list of controls.
Controls.Add(menu);
// Assign the menu to the form.
MainMenuStrip = menu;
// Disable Save and SaveAs since there is no file open.
menuFileSave .Enabled = false;
menuFileSaveAs.Enabled = false;
|
|
|
|