|
Probably you should get list of *.lnk files in desktop directory:
DirectoryInfo di = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
FileInfo[] fi = di.GetFiles("*.lnk");
Keep in mind, that system links (My computer, My Documents) has no lnk file.
Then, for each lnk file you should call shell function CreateShortcut:
IWshRuntimeLibrary.WshShellClass ws = new IWshRuntimeLibrary.WshShellClass();
IWshRuntimeLibrary.IWshShortcut sc;
for (int i = 0; i < fi.Length; i++) {
sc = (IWshRuntimeLibrary.IWshShortcut)ws.CreateShortcut(fi[i].FullName);
}
Don't forget to add reference to %system32%\wshom.ocx.
sc object will hold all information about link:
sc.TargetPath - link target
sc.Arguments - launch arguments
sc.IconLocation - string, that could be used to get icon.
These two articles could be helpful for icon extraction:
Win32
.NET
Hope it helps.
____________________________________________
Robin Panther http://www.robinland.com
|
|
|
|
|
Hi
How can I add a child to a node which I know the index of? the only examples I can find are using the "selectednode" property.
cheers
|
|
|
|
|
try treeView.Nodes[index]
Ed
|
|
|
|
|
Thanks. Now that I've selected the node how will i be able to add a child?
cheers
-- modified at 4:10 Saturday 1st April, 2006
|
|
|
|
|
1) You don't need to select it to add nodes
2) treeView.Nodes[index].Nodes.Add(new TreeViewNode)
Ed
|
|
|
|
|
|
Hey
Basically I have a project with several forms which each need to access teh same instance of the Prog class. Where should I define this instance to make it visible to all forms?
Cheers
|
|
|
|
|
Hi
I create a Glob class ( Global is a keyword ), then create public static properties for global variables.
internal class Glob
{
private Glob() { }
private static Prog _Prog = null;
public static Prog Prog { get { return _Prog; } set { _Prog = value; } }
}
Some people say that global variables are a bad thing, but like any construct, they are sometimes useful
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
|
hey guys I have two questions ( sorry if they are stupid ones ...)
1- I have two forms in one i declare a variable
public int number;
Then i assign a number to it and i want to use it in my second forms
firstform ff = new firstform();<br />
messagebox.show(ff.number.tostring());
I don't get the correct number ?!
2- I have a Combo Box, the list comes from a table called StateDB
State_cb.DataSource = StateDS.Tables["StateDB"];<br />
State_cb.DisplayMember = "StateName";
and it works but i also want to bind it with another table meaning that in my second table called University i have a list of people that are from diffrent universities when my form is loaded I want to have the correct state for that person already selected but it doeasn't work out that way.
State_cb.DataBindings.Add("SelectedItem", myDS.Tables["UniversityDB"], "UniState", true);
Is it possible to do so ??!!
sorry it got so long
Tnaks
-- modified at 2:51 Saturday 1st April, 2006
|
|
|
|
|
mrkeivan wrote:
I don't get the correct number ?!
What do you mean by this?
I'm taking a guess in the dark here but:
You've already got a form which contains a number and you want to get that number from it. The statement:
mrkeivan wrote: firstform ff = new firstform();
will create a new instance of the class and have a "new copy" of the variable. If you want to access the other instance of the form then you'll have to create a property or field that's accesible to both routines so that you are getting it from the correct instance.
Ed
|
|
|
|
|
ok let me light you up , I have to forms, in form one I have a variable called Number
public int User;
in the process this variable recieves a number.
In the second form I need this number for another process, but all i get is either Zero or nothing.
how about the second problem about the combo box can you help me out with that one too ?
Thanx alot
Mr.K
|
|
|
|
|
I still think that it's because you're creating two instances of the form, i.e. you're retrieving the number from a new copy of the form. (Based on your new firstform statment).
mrkeivan wrote: Zero or nothing.
Eh? For an int zero is nothing
mrkeivan wrote: how about the second problem about the combo box can you help me out with that one too ?
I don't do that much databinding so can't think of the top of my head and don't have the time to mess around trying things out. Sorry.
Ed
|
|
|
|
|
I also think the same, that the problem goes back to creating two instances of the form, so how can i do that, is there any way i can call that form with out creating an instant of it ?
I was thinking about creating a class to hold the data but again i gotta creat a new instant of that clas:(s !?!
|
|
|
|
|
mrkeivan wrote: I also think the same, that the problem goes back to creating two instances of the form
Why didn't you say you were creating two instance of the form, it's a guarantee that this is the problem
mrkeivan wrote: is there any way i can call that form with out creating an instant of it
Yes, multiple ways, the easiest would be in the form which creates the secondary form, create a public field / property which is accessible to all the method ("processes") which you require. They can then reference the form through them.
Ed
|
|
|
|
|
Thanks man, thats was very helpful
Mr.K
|
|
|
|
|
Hi all,
Could any one tell or send me the differences between HTML and XML :->
Thanks alot
Hamody
|
|
|
|
|
|
HTML is used to make web pages.
XML is used to handle data.
---
b { font-weight: normal; }
|
|
|
|
|
In the project I am working on ,I need to add new records in a database and show the first column of all these existing records in a dropdownlist on the same page.The problem is that when I add a new record its value doesn't get reflected in the dropdownlist and I need to refresh the page to see the changes.What should I do so that I will not need to refresh the page and still the value will get added to dropdownlist.
Thank you.
|
|
|
|
|
if you dropdownlist is called for example dropDownList1.
dropDownList1.DataBind();
|
|
|
|
|
I have already done it ,my code on page load is
query = "select * from CashDataTable";
conn = new OleDbConnection("FILE NAME=C:\\abc.udl");
conn.Open();
cmd = new OleDbCommand(query,conn);
reader = cmd.ExecuteReader();
DropDownList1.DataSource = reader;
DropDownList1.DataTextField = "AcctNumber";
DropDownList1.DataValueField = "AcctNumber";
DropDownList1.DataBind();
conn.Close();
but still it doesn't work.
|
|
|
|
|
you are doing that on Page_Load, that only runs when the page loads, that's why it updates when you refresh the page,
if you want to force it to update you need to call DataBind again.
I don't know how you are updating the database, You might need to set the autopostback of controls that update the database to true. In that case you won't need a separate call to the DataBind method because it's executed at the database level, however, it also depends on what you are doing the the dropdownlist, if you want to keep the selection the user makes you need to check the IsPostBack property and not bind the control every time the page loads,again, not knowing more is difficult to say how to do it.
|
|
|
|
|
Hi there,
I'm looking for a free dockable panel (VS 2003/2005 like) for using in my C# windows application.
Can you help me?
Thank you in advance.
-- modified at 0:32 Saturday 1st April, 2006
|
|
|
|
|
You might want to take a look at WeifenLuo.WinFormsUI.Docking, I don't know if there's a homepage for it but it's integrated in SharpDevelop and you can get the source and compiled binaries from the SharpDevelop downloads
Ed
|
|
|
|