|
Does anyone know how to loop through all icons in an embedded folder and populate an imagelist. As seen below, I have an embedded folder Prud.Library.Icons.State which contains a set of icons. I would like to add all Icons in State to an ImageList regardless of their name.
Does anyone know how this can be done?
Thanks heaps.
Note: string sIconName = "Prud.Library.Icons.State.Icon1.ico";
System.IO.Stream objStream = null;
System.Drawing.Icon[] objIcon;
try
{
/*
* Stream Icon and add to ImageList
*/
objStream = this.GetType().Assembly.GetManifestResourceStream(sIconName);
if (objStream != null)
{
objIcon = new System.Drawing.Icon[1];
objIcon[0] = new Icon(objStream);
}
}
catch (Exception err)
{
throw err;
}
finally
{
/*
* Dispose of Stream Object
*/
if (objStream != null)
{
objStream.Flush();
objStream = null;
}
}
return objIcon;
|
|
|
|
|
I know this is a tough one, but any help would be greatly appreciated.
Thanks in advance.
|
|
|
|
|
is there a way to have the microsoft agent character ask a user questions, and when they click yes/ok do one thing and no/cancel do another?
|
|
|
|
|
Hi,
Is there any way i can read remote machine registry in c#.
I will appreciate if some one give me code to read remote machine registry.
Regards,
Waqar.
|
|
|
|
|
You can read from a remote registry using the following static method:
Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(...)
However, according to the MSDN documentation, the following must be ensured:
In order for a key to be opened remotely, both machines (the service, and client) must be running the remote registry service, and have remote administration enabled.
Cheers,
Miahrugger
|
|
|
|
|
You also only have access to the HKEY_LOCAL_MACHINE and HKEY_USERS keys
|
|
|
|
|
Hello,
are .NET form based desktop applications executable on other platforms with .NET framework installed? for example Linux
Thank you
|
|
|
|
|
|
How does this compare with Mono?
|
|
|
|
|
Tell me if you know. Thanx in advance. If not, which control can display both image and HTML code correctly?
|
|
|
|
|
1) No.
2) Any web browser control : Mozilla ActiveX, IE ActiveX, ...
RSS feed
|
|
|
|
|
Thanx u very much
|
|
|
|
|
Subject says it all. Can a function return an array of delegates?
|
|
|
|
|
public class Test {
public delegate void DelegateExample(string[] args);
public static DelegateExample[] GetDelegates() {
return new DelegateExample[] {
new DelegateExample(Test.Main),
new DelegateExample(Test.Main)
};
}
public static void Main(string[] args) {}
}
Regards,
Jeff Varszegi
|
|
|
|
|
Or even better look at delegate.GetInvocationList()
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Thanks
How would I use that with a function though?
|
|
|
|
|
I need to know how to disable the user's ability to add new rows to the DataGrid based on a DataTable. I have a table that represents options that can be checked on and off with a boolean column. It is a static list of options, so the user shouldn't be able to add new rows. The only thing in the table that is not read-only is the true/false value of the boolean column. I hope I am just overlooking some obvious setting in the TableStyle (I am programmatically creating the style). Any help would be greatly appreciated. Thanks.
|
|
|
|
|
DataGrid doesn't have such an option, neither DataTable. But DataView has:
AllowNew, plus AllowEdit and AllowDelete. The simpliest way is to set as DataSource of the DataGrid a DataView of your DataTable, and set AllowNew =false.
If you can't set as DataSource a DataView (and DataSource is a DataTable), then you still have a chance , since the data grid actually uses the DefautView of a DataTable . So, you can do something like MyTable.DefaultView.AllowNew=false;
If your DataSource is a DataSet then you can do something like this:
CurrencyManager cm =(CurrencyManager)BindingContext[MyDataGrid.DataSource,MyDataGrid.DataMember]
// Cast the IList to a DataView to set the AllowNew property.
DataView dv = (DataView) cm.List;
dv.AllowNew = false;
Best Regards,
Daniel Zaharia
|
|
|
|
|
Thanks that did the trick. I used...
myTable.DefaultView.AllowNew = false;
|
|
|
|
|
I am trying to find a way to take records from a ListView control and move them to the system clipboard so they can be pasted directly into Microsoft Excel.
I have found the DataFormat class and see it supports a CommaSeparatedValue format, but I cannot get it to work correctly.
I have tried this, just as a test...
string s = "1,2,3,4,5,6,7,8,9";
DataObject d = new DataObject();
d.SetData(DataFormats.CommaSeparatedValue,s);
Clipboard.SetDataObject(d,false);
But when I paste it into Excel I get
–§žý;pC¦yVk²ˆû
Have any of you ever successfully formatted data, stored it in the Clipboard so it could be successfully pasted into Excel?
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
The Comma-Delimited Value isn't a string - which is the confusing part. The following code will do what you want.
// Place comma-delimited on clipboard
string commaText = "1,2,3,4,5,6,7,8,9";
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(commaText);
MemoryStream stream = new MemoryStream(bytes);
DataObject dataObject = new DataObject();
dataObject.SetData(DataFormats.CommaSeparatedValue, stream);
Clipboard.SetDataObject(dataObject, true);
// Read comma-delimited from clipboard
string values=string.Empty;
IDataObject dataObject = Clipboard.GetDataObject();
if(dataObject.GetDataPresent(DataFormats.CommaSeparatedValue))
{
StreamReader streamReader = new StreamReader((Stream) dataObject.GetData(DataFormats.CommaSeparatedValue));
values = streamReader.ReadToEnd();
streamReader.Close();
}
Console.WriteLine( values );
|
|
|
|
|
I tried out your code and it works great!
I have just two questions...
1) where on earth did you dig this up - I have searched all over the place
2) This pastes a single row into Excel - how to I paste multiple rows?
Thanks so much for your help!
dpb
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
Never mind on the 2nd question. If I insert a "\n" character in the string then it wraps to the next line in Excel!
"1,2,3,4,5\n6,7,8,9"
Thanks again for your help.
dpb
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
Hi,
i must admitt that i dont undestand s##t how the new longhorn stuff is going to work ,
so im hoping someone can help me understand this
1) this AVALON thing , is that the gui engine in longhorn?
2) is XAML a language that is intended to replace languages like c# , or what is the purpose of XAML?
3) can i code NON winforms controls in c# under longhorn? , meaning , if AVALON is a vectorbased gfx engine thinge , does it allow me to use c# to create custom controls for it?
4) is it correct that the XAML thinge is not the actual language , it is only indended to describe a UI , much like html , while i still use c# to make "codebehinds" , much like in asp.net but for winforms apps??
(and yes ive read the longhorn/win32 post in the lounge and i still dont get this)
//Roger
|
|
|
|
|
1. MSDN describes Avalon as the "new Longhorn presentation subsystem." In other words, yeah, a new 3d-accelerated GUI engine specific to Longhorn.
2. XAML is not intended to replace any languages. XAML itself isn't a true programming language per se (example, you can't create functions, variables, etc.), it's very much like HTML and how it's used to describe web pages or XML and how it's used to describe relational data; they're all used to describe things, none of them actually perform things. In XAML's case, it will describe UI elements.
3. Yes, in addition to System.Windows.Forms.Controls, we'll also have the MSAvalon namespace. While I haven't read enough into the API to know if we can create custom Avalon controls in the traditional manner, we'll certainly be able to do custom controls by using a combo of MSAvalon and XAML.
4. XAML is a language, just like HTML or XML is. But yes, it's only intended to be used to describe UI elements, it can't be used by itself to create an app. MSDN describes typical Longhorn apps being comprised of your choice .Net language, like C#, with UI pages being written in XAML. Of course, we'll still have access to Windows Forms, but I'm guessing MS won't focus much on that.
The graveyards are filled with indispensible men.
|
|
|
|
|