|
An interface contains empty methods, properties, and events (and mabe some other things). When a class "inherits" an interface that class must implement all that is defined in the interface. Interface members must be public and the class "inheriting" the interface must expose all the interface members a public. Create a simple interface with a method or two and make a class that impliments it. Visual Studio 2005 can implement the interface for you if you tell it to do so.
interface AGetter
{
Stuff GetTheStuff();
}
class StuffGetter : AGetter
{
public Stuff GetTheStuff()
{
Console.WriteLine("Gettin the stuff...");
Stuff aBunchOfStuff;
...
returm aBunchOfStuff;
}
}
static int Sqrt(int x) { if (x<0) throw new ArgumentOutOfRangeException(); int temp, y=0, b=0x8000, bshft=15, v=x; do { if (v>=(temp=(y<<1)+b<<bshft--)) {="" y+="b;" v-="temp;" }="" while="" ((b="">>=1)>0); return y;
|
|
|
|
|
Hi Henize,
Thanks for your answer. It really made sense to me to get the idea about Interface. But I was wondering, what is the use of this Interface ? Why do I need that ?
Regards.
Emran
|
|
|
|
|
Interfaces are useful for specifying functionality for different classes, so that you can use that functionality without caring about the exact data type of the class.
For example data binding uses a data source that implements any of the interfaces IEnumerable or IListSource. That means that anything that implements any of those interfaces can be used as a data source, like an Array, a List, a Dictionary, a DataSet, a DataTable, a DataView, a DataRowCollection, etc.
---
b { font-weight: normal; }
|
|
|
|
|
Interface is an important element of OO design, component design in particular. It acts as a contract between the interface designer and class designer. As long as inheriting classes implement the same interface, their objects are interchangeable at run-time. This enables us to easily "plug & play" objects from different software makers.
Best,
Jun
|
|
|
|
|
An interface can be used as a type. So if you have different classes(types) and you want to do an operation on them you could do this...
ISaveAsWordDocument[] docs = new ISaveAsWordDocument[3];
docs[0] = new LotsOfText();
docs[1] = new GraphsAndStuff();
docs[2] = new Book();
foreach(ISaveAsWordDocument doc in docs)
doc.Save("document ... .doc");
static int Sqrt(int x) { if (x<0) throw new ArgumentOutOfRangeException(); int temp, y=0, b=0x8000, bshft=15, v=x; do { if (v>=(temp=(y<<1)+b<<bshft--)) {="" y+="b;" v-="temp;" }="" while="" ((b="">>=1)>0); return y;
|
|
|
|
|
Hi
Is it possible to use .Net component in COM component without registering it(.Net component ) in registery??
How can i use .Net component in unmanaged component without registering it(.Net component ) in registery??
Regards
|
|
|
|
|
Hello,
I am using SQL Server Everywhere and today I have found SQLite by google search and got confused thinking that, "SQLite could be better...". Do any one has any opinion about comparing these two embedded database solutions ?
Emran
|
|
|
|
|
Firebird is the best embedded database I've found if you want SQL language compatibility.
|
|
|
|
|
Hello,
I was wondering if anyone know how to put dropshadow on a usercontrol. I had a windows form, and used CreateParams (like this: http://davidkean.net/archive/2004/09/13/151.aspx), which works perfectly. Unfortunately this doesn't work when I changed the form to a usercontrol.
I know I can draw the shadow myself, but my question is if there is some "simple" way to get dropshadow on a usercontrol.
Best regards,
Jan-Erik Romøren
|
|
|
|
|
hello
datagrid dosent look good when it have less number of records
cause
it is blank in the bottom area
is there any way to fill that area
thanks
|
|
|
|
|
How do i de install .NET framework 1.1 and re install it. i have .NET framework 2.0 on the same machine and its a windows 2003 server.
How do i do it
|
|
|
|
|
I suspect some thing is messed up with the .NET 1.1 and so i want to reinstall that
The reason i came to that conclusion is that a .NET application i wrote previously which was working previously well is now generating an error
"Application has generated an exception that could not be handled process id = .... Thread id = .... "
The same application works perfectly on my computer and i know that it worked perfectly two days before too on one of our customer computer and some thing was done on that server afterwards.
Well i want to know if there is an easy way to remove it and reinstall it its on windows 2003 server. It does not show up in Add Remove Programs. When i just run dotnetfx.exe(redistributable package) it says its already there.
|
|
|
|
|
lo,
im sending data form com1 to com2, these are all strings;
now i want to send for example name and adress together, so i send them with a marker:
port.WriteLine("1" + txt_name.Text);
port.WriteLine("2" +txt_adres.Text);
on the reciever site i need to put the received string in an array so i can check the first letter, if this is an 1 i can show it in textboxname, is it 2 in textboxadres
how do i put the string recieve, in an array ?
thx
|
|
|
|
|
hi,
you can send your string in comma separated way
for ex.
port.WriteLine("1" + "," + txt_name.Text);
and while receiving it you can split string on comma delimeter and store it in array.
for ex.
string []strarr=strGetString.Split(',');
where strGetString is a string variable in which you receive string data.
hope this works.
|
|
|
|
|
thxx
but how do i check on 1 and 2
i think strarr[0] contains "1" and strarr[1] the rest of the text right?
so do just do this:
string strGetString = ReadLine();
string[] starr=strGetString.Split(',');
if (strarr[0]=="1")
{
textboxname.text = starr[1];
}
grz
|
|
|
|
|
loo
its working just fine; ive implemented it in a database
so everytime i get a name and adress via com its added in a new row in the right column
thxx
|
|
|
|
|
hi,
your wellcome!
Nitin...
|
|
|
|
|
Has anyone ever try to upload file from behind a firewall to a HTTPS site that use SSL certificate?
Thank you in advance.
Thuy
thuybui@msn.com
|
|
|
|
|
|
hi all,
I have a xml file like this
<code>
<?xml version="1.0" encoding="utf-8" ?>
<app-settings>
<sqlconnection string="sql" />
<generate-interval value="" />
<monitors>
<file filename="test.file" />
</monitors>
<templates>
<template xsl="hello1.xsl" outputhtml="hello1.html" xmldata="hello1.xml"
sqlquery="select top 10 * from table1"
linkurl="http://www.test.com/query.aspx?linkid=%aa%"/>
<template xsl="hello2.xsl" outputhtml="hello2.html" xmldata="hello2.xml"
sqlquery="select top 10 * from table1"
linkurl="http://www.test.com/query.aspx?linkid=%aa%"/>
</templates>
</app-settings>
</code>
then I want get and modify the app-settings/monitors/file attribute like 'filename'.
how to do it?
I tried this code, but it doesn't work.
<code>
XmlDocument doc = new XmlDocument();
XmlNode node = doc.SelectSingleNode("/app-settings/templates/template");
if (node != null)
{
Console.WriteLine("ok");
}
else
{
Console.WriteLine("error");
}
</code>
Thanks for your help.
|
|
|
|
|
I forgot this
<br />
doc.Load("123.xml");<br />
|
|
|
|
|
First of all "it doesn't work." isn't very descriptive. So the next time explain in more detail what's wrong.
To modify the app-settings/monitors/file node you should select it:
XmlNode node = doc.SelectSingleNode("/app-settings/monitors/file");
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks for your reply.
Stefan Troschütz wrote: First of all "it doesn't work." isn't very descriptive. So the next time explain in more detail what's wrong.
There is no any exception in my code.
It's just get a null object. and I didn't know why.
Then I found that I didn't 'doc.Load()' before use 'SelectSingleNode' method.
|
|
|
|
|
I am using Visual Studio 2005 and need some methods that are new in .NET2.0, but they don't show up in the code completion list. The one i am looking for is ListBoxt.RefreshItems(). How do I use this?
I have filled a lixtbox with objects that have a ToString() method. I am updating the output for the ToString() from a textbox, but the new text is not shown in the listbox. Does anyone know how to update the listbox without removing and re-adding all the elements?
- Atle
|
|
|
|
|
Did you click on the All tab at the bottom of the Intellisense window? You can still use the method. The list is just being filtered, by default, showing just the most commonly used properties/methods/events of the object.
What do you mean it doesn't update? What does youe code look like that is doing the update?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|