|
Hand hand1 = new Hand(new Card[] { deck.TopCard, deck.TopCard, deck.TopCard });
|
|
|
|
|
i have a xml looks like this:
(?xml version="1.0" encoding="utf-8" ?)
(EventLog)
(Log Date="11/1/2005")
(Event) 10:37:42 AM : System is Successfully Loaded
(Event) 10:45:04 AM : System is Successfully Loaded
(/Log)
(Log Date="11/2/2005")
(Event) 8:39:32 PM : System is Successfully Loaded
(Event) 8:40:18 PM : System is Successfully Loaded
(/Log)
(/EventLog)
and i have a method which displays those xml data into the datagrid:
XmlDocument docXML = new XmlDocument();
docXML.Load("EventLog.xml");
DataSet dsEvent = new DataSet("Log");
dsEvent.ReadXml("../Debug/EventLog.xml");
dataGrid1.DataSource = dsEvent;
dataGrid1.DataMember = "Log";
dataGrid1.CaptionText = "NetWatcher Event Log";
It displays all the members for "Log" elements.. My problem is.. how to display the members of "Log" for particular date only?( particular "Log"'s attribute)
I've tried something like dataGrid1.DataMember = "Log Date="+@""11/2/05"" and it gives error like datamember Log Date = "11/2/05" was not found.
-- modified at 20:48 Friday 4th November, 2005
|
|
|
|
|
You can filter and sort using a DataView object. Pull the table you want to display out of the DataSet, then create a DataView for it. Set your filter, and then use the DataVeiw object as your .DataSource, rather than the DataSet itself.
|
|
|
|
|
I've tried this but it's still not executable.
DataSet dsEvent = new DataSet("Log");
dsEvent.ReadXml("../Debug/EventLog.xml");
DataView dv = new DataView(dsEvent.Tables["Log"] ,DateToday,"",DataViewRowState.CurrentRows);
dataGrid1.DataSource = dv;
dataGrid1.DataMember = "Log";
dataGrid1.CaptionText = "NetWatcher Event Log";
Note:variable DateToday is the attribute that i want to filter. I provide the node name and attribute and I want to get their childnode
-- modified at 9:45 Saturday 5th November, 2005
|
|
|
|
|
Alright. Let me break it down, to make sure I understand everything. First thing, DateToday is a string variable that you populate elsewhere, correct? I am assuming that your allowing the user to change the date through the UI somewhere?
There are two things that I'm wondering about. First is, are you sure the table in the DataSet that you want to display is called "Log"? Second, are you calling .DataBind() on the DataGrid? If the code was broken down a bit into more granular pieces, say something like this:
<br />
DataSet dsEvent = new DataSet("Log");<br />
dsEvent.ReadXml("../Debug/EventLog.xml");<br />
<br />
DataView dv = new DataView(dsEvent.Tables["Log"]);<br />
dv.RowFilter = "TheDate='11/1/2005'";
dv.RowStateFilter = DataViewRowState.CurrentRows;<br />
<br />
<br />
dataGrid1.CaptionText = "NetWatcher Event Log";<br />
<br />
dataGrid1.DataSource = dv;<br />
dataGrid1.DataBind();
Does any of that help? Make sure you know what the table in your DataSet is called. The DataSet is called "Log", but is the table really called "Log", or is it something else? And at the end of it all, make sure you call .DataBind() on your datagrid.
|
|
|
|
|
First, thanks for you reply. You totally undertood my problem and thanks for all the explanation given. DateToday is a string variable which looks like 11/1/2005. And yes, i have a table named "Log".
Here comes another problem, when i try to run this code, i've got an error like -'System.Windows.Forms.DataGrid' does not contain a definition for 'DataBind' and if i take out the line dataGrid1.DataBind(); then it can be executed but no record is displayed. Why is this happened?
|
|
|
|
|
Sorry for the late reply. Had to go digging through threads to find this again. Seems your using the Windows DataGrid (I thought it was the web DataGrid). As far as I know, the windows grid is supposed to automatically update. Have you tried debugging your code, and checking to see if there is indeed anything in the DataTable? I guess its possilbe that there is nothing being populated, or that there is nothing with the date 11/1/2005. Try running it without the filter and see if it works.
|
|
|
|
|
Hello all,
At this point of my project, I built a very small unmanaged C++ DLL and I'm trying to make it call a C# DLL. However, now I know that this looks like (almost) impossible.
I'm *very* new to C++, I started my project in C# and now I'm faced with the truth that I'll have to use unmanaged C++ for some parts of my project which cannot be done with C#. Is there a way to do this?
Also, if I have an application which was coded with an unmanaged C++ code; can this application call a managed C++ DLL or a C# DLL?
Someone told me to use "COM interop in the C# code to expose my C# types as coclasses." Is this the best solution? if yes, can anyone explain more?
I made a quick search in Google but didn't find much; any hint, link, or advice is highly appreciated.
Many thanks in advance,
Naimi
|
|
|
|
|
1. C# to unmanaged: you have at most three choices:
a. Use interop code (PInvoke) to call functions in the unmanaged dll. Search this site and Google for Pinvoke should get you some examples. This can be tricky, since you must pay attention to things like pointers, and explicitly "pin" things that might be referenced from the unmanged code, so the GC doesn't move them.
b. If the unmanaged dll happens to be a COM dll, you can use TlbImp tocreate a wrapper dll that will handle the managed-unmanaged buisness for you.
c. Write a managed C++ wrapper that exposes the unmanaged dll's methods as managed versions, and handles data conversions for you.
2. Unamanaged to C#. C# dlls are already COM objects, you just need to specify "register for COM" in the project settings (or use the Regasm utility to register the C# dll (use the /tlb option so it creates a type library file for you). It will need to have a strong name key, and should be installed to the GAC. You can the use normal C++ methods to deal with the C# dll as a COM component.
(use #import to import the type library and create interface wrapper methods for you)
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
I have a application with a datagrid...
Works fine but i want to remove the "add a new line row", the one starting with * at the left side.
I removed it with datagrid1.ReadOnly = false, but the i cant edit the fields already in the datagrid...
How can i solve this problem?
//Johan
|
|
|
|
|
I'd like to make my C# implment the IDownloadManager COM component for IE to handle certain types of files.
Here's an MSDN article on the process, but it's for C++.
http://support.microsoft.com/default.aspx?scid=kb;en-us;327865
Anyone ever develop this component in C#? If so, can you paste the code for your interface?
Thanks,
Tim
|
|
|
|
|
I have service that is installed in several workstations. The service uses the same port number.
I would like to create an application that detects how many workstations have the service installed in the subnet.
Maybe by detecting the listening port or by the service name.
Any help will be greatly appreciated
|
|
|
|
|
Hi there,
IMO, I'd detect the installed service by the listening port. Just simply create a connection to the remote machine on that port. if it's successful, that means the service is installed there
<< >>
|
|
|
|
|
When attempting to run a 1.1 based exe on 2.0, you get an ugly TypeInitialization exception.
I have yet to attempt running 2.0 on 1.1 machine.
Either way, assuming the app does not have access to it's native framework, does anyone know a good way to display a user-friendly message explaining the problem?
|
|
|
|
|
If it's possible, you're probably better off checking for the framework before the application is installed, and letting the user install it before proceeding further. That's what we do and it works pretty good since our installer is not .NET based. I suspect you are in the same situation.
Innosetup[^] is a great free installation tool.
Carl Mercier
Geek entrepreneurs, visit my blog! [^]
|
|
|
|
|
Thanks Carl, I'll check it out...
|
|
|
|
|
Tom Ollar wrote: When attempting to run a 1.1 based exe on 2.0, you get an ugly TypeInitialization exception.
I have not seen this problem. Did you apply the .NET 2.0 element stuff in the App.config file? I have ran my rather complex application without issues on both runtime, binary serialization is even forwards and backwards compatible
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
The app is the MiniWalker.
The current version was compiled with VS 2003 and it only runs with the 1.1 Framework. On a machine with only the 2.0 Framework installed, it crashes with the Type Initialization error.
Microsoft says this is correct here.
So it looks like a real setup program is the only answer...
-- modified at 10:20 Saturday 5th November, 2005
|
|
|
|
|
Hello All, Not sure where to post this.
I'm looking for advice on the following. Within Excel, I'd like to have the ability to pass some parameter and get back an image corresponding to that parameter. For example, imagine you pass in "MSFT" and "1yr" and get back a stock trend image. Ideally, I'd be passing in an array of values, and for each image, I'll place it on the adjacent cell of the selected value.
The image is created using a Java tool sitting on a separate server. The tool grabs some data from a db using the parameter passed in and then generates the image accordingly. I can wrap that up as a web service.
I could then consume this service in Excel and get the image for each value passed and place it as a bitmap in a cell in Excel.
Does anyone have advice or can point me to a solution or sample that already exists for this?
I don't really have to do it C# or .NET at all for that matter, but it certainly would be ideal.
I have Office 2003.
Thanks
Julian
|
|
|
|
|
hi,
I am doing a project in C# winform.
When I run the app, I want to display the form in the entire screen (even the taskbar and the status bar should not be shown). The app should take over the entire screen.
How do I do this??
Thanks.
|
|
|
|
|
Set these 3 properties or do it in the designer.
this.MaximizeBox = false;
this.TopMost = true;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
|
|
|
|
Thanks!!!!
|
|
|
|
|
|
Hello!
I have a big problem...
I'm working with a richTextBox and I need to know how every characters is painted..I dont know if you understand!
The problem is the following:
i have a string in a richTextBox and i can color every characters of it by a different way. Depending by the color, i must put a prefix in front of each char...
Any suggestion..?
Thank You
Enrico
|
|
|
|
|
The easiest way is to use the SelectionColor[^] property. However, moving the Selection character by character doesn't seem to be a great idea.
You can also try getting the Rtf[^] property and then parsing it to figure out the colors. You can find the RTF Spec here[^].
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|