|
I set up the following and it appeard to work fine for me without any problems.
public interface ITest
{
void TestFunc1();
void TestFunc2();
}
class Test1 : ITest
{
public void TestFunc1()
{
MessageBox.Show("Here1");
}
public void TestFunc2()
{
MessageBox.Show("Here2");
}
}
class Test2: ITest
{
public void TestFunc1()
{
MessageBox.Show("Here3");
}
public void TestFunc2()
{
MessageBox.Show("Here4");
}
}
private void button1_Click(object sender, System.EventArgs e)
{
ArrayList al = new ArrayList();
al.Add(new Test1());
al.Add(new Test2());
((ITest)al[0]).TestFunc1();
((ITest)al[1]).TestFunc2();
}
I got "Here1" and "Here4" as exptected
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
In Visual C++, you can define the output path for a pdb file like so:
/PDB:c:\Some\path\to\my\debuginfo.pdb
which lets us keep all the pdb's in a single location
However C# only seems to have an option to turn on the debugging info, but nowhere to specify where the info should go
Does anyone know if there's an option somewhere I'm missing?
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Nope. You didn't miss anything, you just can't find what's not there...
C# Compiler Options[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In a particular situation, I have a KeyPressEventArgs.KeyChar property from which using the code I am getting value of selected Ascii character. I am able to show all lower ascii characters on the keyboard. If I want to show upper-case (or upper) characters for these keys, I am able to use the ToUpper() method to get the upper characters on the alphbatic keys (i.e., from "A" to "Z"). However, when I try to get the upper keys on the numeric keys, I am not able to use ToUpper() method.
The problem is that in the particular program on which I am working, I am getting only partial ascii values (i.e., lower keys only and not the upper keys). Due to some peculiar reasons, I have to live with this situation. I want to get the upper keys on the keyboard by checking the status of the "Shift" key.
Thus, how can I get the upper keys of the keyboard (for numeric keys) such as #, ^, &, *, $, etc. by programatically combining with Shift key status the the lower key values such as 5, 6, 7, 8, etc.? Is there any method equivalent to ToUpper() which can be used to convert, say 4 to $ (i.e., lower to upper key)?
|
|
|
|
|
|
thanks for the quick reply.
But, even as per a given layout of a keyboard, can i represent the upper key (whatever it may be in a keyboard layout) using the lower key and the status of Shift, by accessing some method similar to ToUpper.
I have seen method such as IsSymbol in the char structure, which can tell me whether it is a symbol or not. My problem is how to get the symbol on the upper key(whatever it might be) from the lower key?
I hope I am clear about the requirement facing me.
|
|
|
|
|
.ToUpper() does NOT mean the upper, or Shifted, character on the keyboard. It simply converts a string to its Upper Case equivalent (lower case, UPPER CASE.) There is no function that will convert your key code to whatever the Shift-keycode is.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How do I start a service programatically? Is there a way to do it from the command prompt or in the service installer?
Thanks a lot,
Jim
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
|
Thanks, but how do I use that? I don't see a start command.
Thanks,
Jim
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
try this:
this.serviceController1 = new System.ServiceProcess.ServiceController("place here the name of the service");
serviceController1.Start();
|
|
|
|
|
You didn't look very hard. ServiceController.Start Method[^] docs on MSDN.
ServiceController myService = new ServiceController(@"MyServiceName");
if ( (myService.Status.Equals(ServiceControllerStatus.Stopped) ) ||
( myService.Status.Equals(ServiceControllerStatus.StopPending) ) )
{
myService.Start();
}
else
{
Console.WriteLine("Service is already running...");
}
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello people,
i'm using the DAAB (Enterprise Library) to access the data in my system. But I need to use the schema from the tables i'm reading....
when I was using the default DataAdapter, I have used the FillSchema() method, but now, when I use de DAAB to fill de data, I couldn't get the primary keys columns, unique columns neither autoincrement columns...
This is the code that i'm using to get the data with DAAB:
===========================
Database db = DatabaseFactory.CreateDatabase();
DBCommandWrapper cmd = db.GetSqlStringCommandWrapper("SELECT * FROM Customer");
ds = db.ExecuteDataSet(cmd);
===========================
But this code don't return the schema from the "Customer" table.
Do you have any tip to do it?
thanks people
André
|
|
|
|
|
Hi all,
Is there any API to change the system locale ?
I need to write a C# application which takes LCID as input, and based on the LCID it should change the system locale.
Thanks
Mahesh
|
|
|
|
|
how about putting this into the main
CultureInfo ci = new CultureInfo("De-de");
Application.CurrentCulture = ci;
the constructor of the cultureinfo accepts both - a string for the region or the code as int
|
|
|
|
|
SharePoint provides options to create sites with different types of locales available out of the box. Suppose we have a SharePoint site built using the English locale and we want to change the existing site to some other locale then this can be achieved using the following piece of code. Changing the locale of the site helps display the date and number formats with their respective decimal and group separators.
http://www.mindfiresolutions.com/Changing-SharePoint-site-locale-programmatically-834.php[^]Cheers,
Eliza
|
|
|
|
|
Anybody have a component that can use C# to view Autocad file like zoom in, zoom out?
|
|
|
|
|
|
Hi,
I am trying to read data from an Excel spreadsheet cell by cell which contains data with which I want to perform string manipulation and then save to SQL srvr..all the data in the spreadsheet are of a string data type..
I have recieved some help from one of the members of this site who gave me some direction, but using VB.NET code...I want to specifically use C# for this task.
How do i open the .xls file in order to read data from it??
How do I read the data from the cell(s) in a specified worksheet??
and (if i need to) how do i close the .xls file??
any advice and help will be greatly appreciated.
Thanks a million..
Afzal Hassen
Afzal Hassen
|
|
|
|
|
How do I access the item from the drop down list when I click the button?
Chindiwo
Jnr. Programmer
-----
|
|
|
|
|
ComboBox.SelectedItem
mav
|
|
|
|
|
Mav this a good e.g of what I want to do
label1.Text = combobox.SelectedItme.
and if I do that, there's errors
Chindiwo
Programmer
-----
|
|
|
|
|
in this case just use:
label1.Text = combobox.SelectedText;
|
|
|
|
|
thanx for your time, but this is how it suppose to be.
label103.Text = IncomeCombo.SelectedItem.ToString();
Chindiwo
Programmer
-----
|
|
|
|
|
That's simple: label1.Text is of type string, combobox.SelectedItem is of type object, that's what the error most likely tells you.
Reading (and understanding!) the errors you get is the key to successful programming.
Convert the object to string by using ToString() for example.
Try:
if (combobox.SelectedItem != null)
label1.Text = combobox.SelectedItem.ToString(); Regards,
mav
|
|
|
|