|
It's because of the two different methods of implementing.
You can implement an interface implicitly or explicitly. Consider the sample below. IMyFirstInterface is implemented implicitly. That is the implementation that will implicitly be used unless you explicitly state otherwise.
IMySecondInterface is implemented explicitly - you have to explicitly state that you want to use that implementation.
MyImplementingClass implementingClass = new MyImplementingClass();
implementingClass.Method(1);
if (implementingClass is IMySecondInterface)
{
((IMySecondInterface)implementingClass).Method(1);
}
public class MyImplementingClass : IMyFirstInterface, IMySecondInterface
{
#region IMyFirstInterface Members
public void Method(int value)
{
Console.WriteLine(value);
}
#endregion
#region IMySecondInterface Members
void IMySecondInterface.Method(int value)
{
Console.WriteLine("Value = {0}", value);
}
#endregion
}
public interface IMyFirstInterface
{
void Method(int value);
}
public interface IMySecondInterface
{
void Method(int value);
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
DaveyM69 wrote: (Example 1)
If you're absolutely sure that A implements the interface in question then you can do an implicit conversion).
The compiler takes care of ensuring that A implements the interface, doesn't it? Otherwise it wouldn't let the implicit conversion succeed.
|
|
|
|
|
Correct - of course!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
"An interface is a contract that guarantees to a client how a class or struct will behave. When a class implements an interface, it tells any potential client "I guarantee that I'll support the methods, properties, events, and indexers of the named interface"
So it does not contain any executable code. The method which is getting called is the method what you have implemented. In this case the get()
There may be a question arise when both the interfaces have same method name, return type, argument list and both the methods should be implemented.
At that time you can specify the interface name prior to the definition.
Have a Happy Coding.....
|
|
|
|
|
I want to fill combo box with the values in Excel usind ADO.NET and C# i have written a code bit its not working. Kindly help.
private void FillAccounts()
{
try
{
string excelFile = @"C:\Capacity Planning\Accounts.xls";
//String sConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " + @"C:\Capacity Planning\Accounts.xls" + ";Extended Properties=Excel 12.0 Xml;HDR=YES;:Max Buffer Size=256;";
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + excelFile + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'";
OleDbConnection objConn = new OleDbConnection(sConnectionString);
objConn.Open();
OleDbCommand objCmdSelect = new OleDbCommand("SELECT Account,Link FROM [Accounts$]", objConn);
OleDbDataAdapter objAdapter = new OleDbDataAdapter();
objAdapter.SelectCommand = objCmdSelect;
DataSet objDataset = new DataSet();
objAdapter.Fill(objDataset);
cbAccounts.DataSource = objDataset.Tables["Accounts"];
cbAccounts.DisplayMember = "Account";
cbAccounts.ValueMember = "Accounts.Account";
objConn.Close();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
Thanks a lot in advance
shantanu
|
|
|
|
|
Hi
When changing a value in any cell in DataGridView , this value is saved into the related dataset only after the user clicks on an other cell in an other row !
Even the mecthod AcceptChanges() will not save the contents of this cell unless the user moves to an other row . I need to save these contents straight away without forcing the user to leave the cell .
any Ideas ?
thanx .
|
|
|
|
|
unitecsoft wrote: without forcing the user to leave the cell
How will you know when the user is finished with editing then? Saving the current value at each keypress is going to be inefficient
I are troll
|
|
|
|
|
the problem is even if you save by clicking a SAVE button which will fire AcceptCanges() method , the contents of the cell are not saved unless the user previously leaves the row which include that cell .
|
|
|
|
|
If he clicks a save-button, doesn't that move the focus to the button (and out of the cell, triggering validates and such)?
I are troll
|
|
|
|
|
Yes , but does not save the value of that cell !!! I don't know why !!!
the only way to save it is to click a different ROW within the grid .
|
|
|
|
|
That shouldn't be happening, according to the documentation;
"When you call AcceptChanges on the DataSet, any DataRow objects still in edit-mode end their edits successfully." (Source[^])
Can you post the offending code?
I are troll
|
|
|
|
|
Hi all...
I've got a problem with a crystal report app (Delphi) and I need Help. I got the following code to work on two machines but it keeps failing on the client server. Can someone tell me why. PS The client server works with a XBase driver the two Machines I got it to work on runs a foxpro driver. That is the only thing I can pick up thats different...
dtmVision.crGeneric.Tables.ItemIndex :=0;
dtmVision.crGeneric.Tables.Item.Name :='System.dbf';
dtmVision.crGeneric.Tables.ItemIndex :=0;
dtmVision.crGeneric.Tables.Item.Path :=sDBPathForVision;
dtmVision.crGeneric.Tables.ItemIndex:=1;
dtmVision.crGeneric.Tables.Item.Name:='Customer.dbf';
dtmVision.crGeneric.Tables.ItemIndex :=1;
dtmVision.crGeneric.Tables.Item.Path :=sDBPathForVision;
dtmVision.crGeneric.Tables.ItemIndex := 2;
dtmVision.crGeneric.Tables.Item.Name :=sFnTempTRans;
dtmVision.crGeneric.Tables.ItemIndex :=2;
dtmVision.crGeneric.Tables.Item.Path :=ExtractFilePath(sFnTempTRans);
crGeneric is of type TCrpe
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Sorry wrong form ignore this post please
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
download the checked record from the gridview using c#
|
|
|
|
|
Is this a question?
I assume that the checked record represents a file or sth similar. If you press a button like "Download" you can catch the event in your code behind and send the file content as response.
Regards
Sebastian
|
|
|
|
|
when i click download button the checked file in gridview will download using asp.net and c#
|
|
|
|
|
Now, which seems more likely to you - that this question will be answered in the C# forum where lots of people have NO knowledge of ASP.NET, or the ASP.NET forum?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
|
Rahad Rahman wrote: give me solution
Get stuffed. If you can't use google, can't read a book, can't use intellisense, have no idea how C# or winforms works, and can't even ask nicely, then why should we help you ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hear hear.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Rahad Rahman wrote: give me solution
Call 911
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Look into System.Drawing.Image.Save and System.Drawing.Image.FromFile. That's all you'll be getting from me though. "Give me solution" is hardly acceptable post content - its rude and rather annoying. Besides, the only person who can help you now is a shrink
|
|
|
|
|
You already asked this question yesterday
You didn't even bother to read those reply's did you, hell all you did is switch the subject and content. And if you did read the reply's you either didn't understand them or you chose to simply ignore them.
If you didn't understand them what make's you think you'll understand it now?
'give me solution' sounds allot like an order, I don't take orders from forums (neither does anyone else around here)
|
|
|
|
|
hmmm what would help? reading a book? maybe about c#?
|
|
|
|
|
Im trying to learn how to attach a file to the form..The idea
is, the user can not only add a record but will also be able to add an
attachment for that particular record....lets say I would like to add
an excel or word doc...this has nothing to do with sending attachments
and emails and stuff like that...just attaching a file to the form...
plz help!
|
|
|
|