|
|
What's this?
'A programmer is just a tool which converts caffeine into code'
|
|
|
|
|
If you need to post code containing generics (using angle brackets), please the check the "ignore html tags in this message" checkbox before you post.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
I'm terribly sorry. I thought I didn't post the message...
Anyway, I answered the question I had myself.
|
|
|
|
|
I'm working to an application which use a DataBase (Access format *.mdb).
So i have a DataSet which contains a table of this DB and i want to represent it in a DataGrid...How ca i do it?
Thank You
Enrico
|
|
|
|
|
myDataGrid.DataSource = myDataSet.Tables["myTableName"];
or
myDataGrid.DataSource = myDataSet;<br />
myDataGrid.DataMember = "myTableName";
I hope you understand...because is a rough world out there...
|
|
|
|
|
hello!
i'm new here so please help me!
i'm doing a project...
i need to communicate from the computer to device whis RS232 cable
is there a class at the C# that takes care about communicating???
with not where i can found a class or someting like that???
waiting to your answers...
thank's
|
|
|
|
|
I belive the 2.0 framework has a class that allows you to talk to the serial ports. The 1.1 does not.
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
can you help me and search a class or something like that that i can use to communicate with the device???
|
|
|
|
|
djtourist wrote: can you help me and search a class or something like that that i can use to communicate with the device???
He did. He told you where a class was available. You just have to use Google or MSN Search to get the documentation on it. You can find it here System.IO.Ports namespace[^]
However, perhaps the pertinent words from your post are "I can use" - since you have not told us what you can use you were given the best answer available without that knowledge.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
hey thank's!
you help a lot
so actully there is a class that takes care of Serial Port!
and thank's again!
(-;
|
|
|
|
|
djtourist wrote: so actully there is a class that takes care of Serial Port!
Yes, and based on what Ray told you previously it took me less than 2 minutes to find the relevant document using MSN Search.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
i got a problem about WMI.
i want use wmi to config my network adapter, such as ip address, subnet mask, etc. and i found some methods of Win32_NetworkAdapterConfiguration class can do this, but they are all enable method, for example, EnableDNS ,it can enable DNS setting and specify dns search order.
THE PROBLEM is how can i DISABLE DNS search, namely , obtain DNS server automatically.
|
|
|
|
|
Ok i am struggling with the factory pattern big time. This pattern seems great if you are creating objects that share all the same properties but i can never find a sample client that uses the specific concrete classes that have different properteries. ( Ok that probably made no sense so here is a sample using generics )
public abstract class Vehicle
{
protected string name;
protected string type;
public Vehicle()
{
}
public Vehicle(string name)
{
this.name = name;
}
public string Name
{
get { return name; }
set { name = value; }
}
public string Type
{
get { return type; }
}
}
// a concrete vehicle
public class Car : Vehicle
{
public Car() : base()
{
}
public Car(string name, string type) : base(name)
{
base.type = type;
}
}
// another concrete vehicle
public class Truck : Vehicle
{
bool 4WD = false;
public Truck() : base()
{
}
public Truck(string name, string type) : base(name)
{
base.type = type;
}
public Engage4WD() // This only exists for a truck
{
4WD = true;
}
}
interface IVehicleFactory
{
T CreateObject<t>(string name) where T : Vehicle, new();
}
public class VehicleFactory : IVehicleFactory
{
public T CreateObject<t>(string name) where T : Vehicle, new()
{
// create instance of Type T where this type derives from Vehicle
T v = new T();
v.Name = name;
return v;
}
}
public class FactoryPatternUsingGenericMethod
{
static void Main(string[] args)
{
IVehicleFactory f = new VehicleFactory();
Car c = f.CreateObject<car>("Kitty");
Truck d = f.CreateObject<truck>("test");
}
}
}
It appears at this point i can get a truck or a car using the factory however what is the benefit of this. This just seems like alot of work when i could have just had a separate truck object and car object inheriting from vehicle and use the new operator without resorting to a factory. Would this not give the same result.
I guess i just can't seem to quite grasp what the big benefit is here for the presentation layer?
Thanks in advance
|
|
|
|
|
The benefit is that you'll have a single point that creates instances of a common base class or interface based on a parameter.
Your class factory should *never* return a Car or a Truck, it should return only Vehicle.
You may argue that this would stop you from using the Engage4WD method from your Truck class. This is because your class inheritance is wrong. A Truck should not derive from a Vehicle, because it does not complies with the Liskov Substitution Principle.
It seems that you're using the flawed "is a" principle for OO design, so, if you don't know LSP yet, please read this document[^] and understand why a Square should not derive from a Rectangle. After reading it, you'll understand why your class factory doesn't help in anything and should return always a base class.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
never heard of the principle, looks like i have some homework. I figured something was wrong, the objects are alike but not enough to work correctly with the inheritance. I'll continue looking at lsp to figure out how i would fix the sample i wrote. It just seems like based on what i've always been told truck would inherit from vehicle because it does share some similar properties.
Thanks
|
|
|
|
|
Daniel Turini wrote: please read this document[^]
That was a really good read.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi there,
I want to make an answering machine with tapi using c# .After connecting , i need to playback a wave file to caller . I tried many way but failed. If anyone know please help me , or give me the code to do that .
Thanks.
|
|
|
|
|
1) Use Google to search for 'TAPI FAQ' there are several GREAT links there.
2) Just as an FYI. You don't exactly use TAPI to play a wave file. TAPIs responsibility ends with giving you a voice handle to a device really.
3) TAPI currently is not great under Managed code. There is a C# interface implementation out there (search on GotDotNet) for it...
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
Now i using VS 2003 and tapi3.x to program.
i think with tapi3 i can play back wave file , but i find that all the sample playback file in MSDN write in C++ . I don't know how to do that in C# .
If you know please help me .
thanks
|
|
|
|
|
And i dont mean a list of processes, like if you had explorer running, looking at drive c, the task name would be DRIVE_C(C , and of course the process would be explorer.
|
|
|
|
|
Hi there!
I'm using the XmlTextReader to parse an XML file. The structure of the file is as follows:
+++
<?xml version="1.0" encoding="utf-8" ?>
<slideshow title="My Slideshow">
<image url="imgurl_1" copyright="copy_1" contact="contact_1">
<en-US>
<title>title_1</title>
<description>desc_1</description>
</en-US>
<de-DE>
<title>titel_1</title>
<description>beschreibung_1</description>
</de-DE>
</image>
</slideshow>
+++
There might be any number of image and language (e.g. fr-FR) nodes in the file.
What I'm trying to do is to find a certain language (e.g. 'de-DE') node. If the node can't be found, I'd like to find a different one (fallback language). But can this be done using the XmlTextReader? I can't seem to figure out how to simply check a node for its title and move on if there is no match. Or do I have to use an entirely different approach?
Thanks in advance and a happy sunday!
/matthias
<br><div style="{width:100%; color:navy; background-color:white;border-top:navy 1pt solid;}"><font size="1">I love deadlines. I like the whooshing sound they make as they fly by. <br>[Douglas Adams]
|
|
|
|
|
Hiya,
XmlTextReader provides a forward-only way of parsing xml documents. This means you don't have random access ability and the means to jump around your xml document. You start at the top and work your way to the end.
With this in mind, if you want a 'fallback' language in your example, you either need to provide this as the last entry in the xml, or else implement a way of parsing which remembers the 'best yet' record from the xml.
Two points about your xml, firstly probably just a typo but the </image> tag doesn't match <img> tag, and secondly you are using the language as the element name <en-US> - this might be better represented as <language name=en-US>.
You can use XmlTextReader.Read() to fetch the next element from the document. Check its NodeType property to determine if it is Element . Then using your xml as it stands you can use the Name property to pick up the element name. From there you can have a boolean flag which you set to tell you're in the right language and can read the title and description.
Hope that makes some sense...
Regards,
Rob Philpott.
|
|
|
|
|
Hi Rob,
thanks for your reply. I've had a look closely last night at the XmlTextReader and figured, that it was not the right thing to use. Switched to the XmlDocument instead for increased flexibility. As for your suggestion to use the language codes (like en-US ) as attribute values, I've done that. Makes perfectly sense.
Thanks for your help! I really appreciated it.
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
I want to set backgroundimage of a MDIForm through coding. So I set it with the help of openfiledialog.
But the problem I m facing is that, it is not in center, the image get "tiled" (many same images on the form) I want only 1 image and it must be in center of the form.
Another problem is that I want to see this BackGroundimage after restarting the application. (I don't want to store the image path in the database)
Please help me out.....
Thanx in advance
--
Harshal Bhakta
Pune
|
|
|
|