|
You can bind against a DataView with the AllowNew and AllowDelete properties set to false . You could also set these properties on the DataTable.DefaultView property, which returns a DataView over the DataTable .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I've seen NetMaster's article on DirectShow (DShowNET) and was excelent in my opinion.
Simple file playback is a joke with this tehnology , but I was wandering about playback from memory or netsockets.I don't mean capture cards , but simple file pre-procesing before playing. As an example , let's say that I wanna send to the filter just the images I want from a movie.My program will take care of pre-procesing but that implies that the filter will be forced to receive input from memory or , in the worst scenario , from a network socket. I've read about MPEG-2 Demultiplexer filter in the DirectX 9 SDK add-on , but I can't quite make it work.
If anyone can help me pls provide an example ( best in C# )
Thanks.
Angel
|
|
|
|
|
Is it possible to implement methods from an interface class as internal in C#? From my first try, it doesn't look like it is possible (the project won't build):
<br />
public interface IMyInterface{<br />
string Name{ get; set; }<br />
}<br />
<br />
public class MyClass : IMyInterface{<br />
internal string Name{ <br />
get{} <br />
set{}<br />
}<br />
}<br />
<br />
...this results in a build error.
But this IS possible to do in VB.Net:
<br />
Public Interface IMyInterface<br />
Property Name() as String<br />
End Interface<br />
<br />
Public Class MyClass<br />
Implements IMyInterface<br />
Friend Property Name() as String Implements IMyInterface.Name<br />
Get<br />
End Get<br />
Set(value as String)<br />
End Set<br />
End Property<br />
End Class<br />
...this generates no errors.
Why is this? If VB.Net can do it, the CLR must allow it, so why can't C# do it?
Would it be because an internal class member defined in an interface doesn't make much sense from a design standpoint? In other words, an internal interface member kind of defeats the purpose of creating an interface in the first place. Is this just a well-thought-out constraint of C#?
- Mike
-------------------------
"No human being would stack books like that." - Dr. Venkman
|
|
|
|
|
C# can, but you're mixing implementation types. You do this in C# using explicit interface implementations, which is what youre VB.NET snippet is doing:
public class MyClass : IMyInterface
{
void IMyInterface.MyMethod()
{
}
} Notice that there's no access modifier. This would be private. This fairly common throughout the .NET FCL. Think about ADO.NET: there's several interface methods but they're all typed; the explicit interface implementation still works and is used to essentially "hide" the "generic" method so that a typed method can be used.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Makes perfect sense. This actually helps open up some other doors that explain a few other things. Muchas gracias.
- Mike
-------------------------
"No human being would stack books like that." - Dr. Venkman
|
|
|
|
|
How can I read the bitmap file pixel by pixel? I need some code.
|
|
|
|
|
Load the file into a Bitmap object and call its GetPixel method.
Bitmap myBitmap = new Bitmap("Grapes.jpg");
Color pixelColor = myBitmap.GetPixel(50, 50);
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Nome
|
|
|
|
|
|
Hi all
I have currently learning to program in C#. I am inspired by the A* path-finding C# algorithms written by Eric Marchesin.
I like to seek help on the implementation of Potential Field Method for robot navigation.
Can anyone show how the complex objects( such as goal, robot, multi-shaped obstacles) can be created systematically ? I am really at a lost.
Other challenges include solving local minima problem and intelligent navigation.
Anyone who has the expertise.Please your help is very much appreciated.
|
|
|
|
|
sodium wrote:
Can anyone show how the complex objects( such as goal, robot, multi-shaped obstacles) can be created systematically ?
What do you mean by "systematically"?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Nome
|
|
|
|
|
methodically would be a better description. Dave, are you capable ?
|
|
|
|
|
Nope. Never touched Navigation algorithms...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Nome
|
|
|
|
|
I am having a problem with xsd convertion to csv file. The code below describes how I attempted to approach the problem. The code works but the output is not properly format.
ObjBISReports As DsReports (a type dataset)
.. after the dataset has been filled using sqldatadapter
ObjBISReports.WriteXml("C:\Tunde.xml", XmlWriteMode.IgnoreSchema)
Dim xslt As New XslTransform()
xslt.Load("F:\Alliance International\Projects\AIA Database Application\Application2\Components\GetOutStanding.xslt")
Dim doc As New XmlDocument()
doc.Load("C:\Tunde.xml")
'Create an XmlTextWriter which outputs to a file.
Dim fileName As String = "C:\tunde.csv"
Dim writer As XmlWriter = New XmlTextWriter(fileName, Nothing)
'Transform the data and send the output to the console.
xslt.Transform(doc, Nothing, writer)
writer.Close()
This is the stylesheet format:
"<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="DsReports">
<xsl:apply-templates select="GetOutStandingBills"/>
</xsl:template>
<xsl:template match="GetOutStandingBills">
<xsl:for-each select="*">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:value-of select="','"/>
</xsl:if>
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>"
Please if anyone knows a much effective means of converting xsd to csv or excel could you let me know.
Thank You
Tunde Olawuwo
|
|
|
|
|
Notice you're using VB.NET - this belongs in the VB.NET forum. But since it really has more to do with the XSLT, the answer is simple: you must set the xsl:output method (assuming xsl is your namespace prefix for the XSL Transform namespace) so that the method attribute is just text . Then you must make sure that a new line is output after the last element in the CSV. A simple way is to output a CR-LF pair like so:
<xsl:text disable-text-escaping="yes"> </xsl:text>
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
oops sorry for posting vb question in a C# region. Thanks I appreciate it!
|
|
|
|
|
How can I recognize the characters in a bitmap using c#?
(Im doning OCR prgram)
|
|
|
|
|
You could Google for 'OCR' algorithms. There is one here[^] on CodeProject.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Nome
|
|
|
|
|
XmlTextReader reader = new XmlTextReader ("faq.xml");
Why is the default directory for this code = c:\winnt\system32? Maybe I'm missing something, but since this code is located inside of a ASP.Net Default.aspx file... shouldn't it default to the web root?
|
|
|
|
|
No it shouldn't. It has to do with the executable path or the current working directory set by the executable.
To open a file in a virtual directory, you should use the MapPath method, which is available both on the intrinsic Server property of several objects (an instance of HttpServerUtility ) or on the Page class itself:
string path = MapPath("faq.xml");
XmlTextReader reader = null;
try
{
reader = new XmlTextReader(path);
}
finally
{
if (reader != null) reader.Close();
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the tip. Do you have any suggetions (websites) for a beginners guide to updating XML files in C#?
|
|
|
|
|
|
I'm trying to find the top of a cell in excel.
i tried this code in vba:
something = OutputWorksheet.Range("A1","A1").Top
this works fine
the only way i've found of getting c# to do the same is:
float something = (float)Convert.ToDouble( OutputWorksheet.get_Range("A1","A1").Top.ToString())
is this really the way i have to do this cast?
Thanks
Russell
|
|
|
|
|
Um, why convert to a Double and then cast to a Single (float )? Also, get_Range returns a Range object, from which you can get the Top and just cast that to a float like so:
Range rng = OutputWorksheet.get_Range("A1", "A1");
float top = (foat)rng.Top;
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi everyone,
I have an application that should support two types of databases (SQL Server and Oracle). What I want to do is create a datalayer that will use SqlConnection or OracleConnection object depending on the database.
In C++ I would have done the following:
template<class ConnectionType>
class DataLayer
{
...
...
ConnectionType * type
}
DataLayer<SqlConnection> m_layer; // for example
How can I achieve the same result in C#?
Thanks,
Sincerely,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
You would use the provider pattern, an abstract class or interface that contains the methods you would invoke. You then use the appropriate implementation (SQL, Oracle, whatever) that you could configure in the application's .config file. We've been using this since .NET 1.0 for our smart client application.
.NET 2.0 will use the provider pattern heavily: for database access, authentication, personalization, and much, much more.
For more information, you should read a couple of recent MSDN articles:
Microsoft MVP, Visual C#
My Articles
|
|
|
|