|
No, because...
0) It sounds like homework
1) You provided absolutely no frame of reference - AT ALL.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
The DataGridView does not support merging cells (or headers) like you find in Excel.
You'll have to use a third party grid to do this. I don't know of one that does, but that doesn't mean they don't exist.
|
|
|
|
|
Is there any way to display arbitrary numbers as subscript in a treeview node's text?
|
|
|
|
|
I would start with making the control owner-drawn, and handling the DrawItem event.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi Omnicoder,
fyi : I am using an excellent WinForms TreeView control called the Integral UI TreeView [^] from Lidor Systems.
Doing html/xml formatted text in Node Text, or in complex content (including other WinForm controls "inside" the Node !) is a great feature : here's an example of how easy it is to do subscripted text :
iuTV1.Nodes[0].Content = "<div>A text with Subscript <font size=\"5\">12</font></div>";
That would result in the first (root level) TreeNode in the instance of the Integral UI TreeView named "iuTV1" being having its run-time text set to
"A text with Subscript " followed by the subscripted text "12."
You could even put a whole HTML/XML table with really complex formatting in Node Text, or anywhere else, if you wished; it's using a very standard "vanilla" set of the most commonly used basic HMTL object and property codes.
Ability to import/export the "whole" Integral UI TreeView (with all its complex visual styles and, possibly, use of controls in Nodes) to XML : that's built-in, implemented simply and cleanly, and does support "HTML Entity Codes" for ASCII like  
If you want to just export/import part of an IUTV (some node with all its possibly nested sub-nodes, or some very complex multi-selection of Nodes) : easy to implement in your own code with a simple work-around (I just instantiate a "hidden" instance of an IUTV [i.e., never actually placed on a Winform], clone the selection to that IUTV, and then save that whole "hidden" IUTV), and I understand that will soon be built-in to the IUTV so you can import/export part of an IUTV to, or any selection to XML as simply as you can save the whole IUTV now.
I've been using the IUTV intensely for over a year; I upgraded to their entire Suite once I saw how good the IUTV was; their technical support is excellent; I'm delighted to say they've actually put a few features into the IUTV that I've suggested over the course of the last year
So it gives me pleasure to recommend their TreeView to you.
best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
modified on Friday, December 18, 2009 6:31 PM
|
|
|
|
|
I am trying to use a hashtable (or equivalent) to store and recover a number of small structures or classes.
The hashtable record will need to have a UInst32 key and an associated data structure or class that looks some thing like this:
bool bRecUsedFlag;
UInt32 uiPGN;
UInt32 uiRecCtr;
byte[] bPGNData;
I can see odd references that indicate that this is possible but every attempt I have to code it is failing.
Can anyone give me a small example of how to create this table, add records to it and get records from it please?
Many thanks, Bruce
|
|
|
|
|
First thing to do is design the class you want to contain your data, and its hash key. Then you just need to use the Hashtable[^] class to store and retrieve your individual objects.
[edit]spelling[/edit]
|
|
|
|
|
That is what I thought was possible but I must be missing a trick because everyway I come at this I hit problems that I haven't solved yet.
Can anyone point this comparative newbie in the right direction with a simple example based on the data in my first email please?
Many thanks, Bruce
|
|
|
|
|
Bruce Coward wrote: Can anyone point this comparative newbie in the right direction with a simple example based on the data in my first email please?
I just did so; did you look at the examples in that link?
|
|
|
|
|
I looked at those examples but all I could see were bog standard string keys and single string data. This I have working. My problem is lifting the data up into a structure or class...
Cheers Bruce
|
|
|
|
|
Bruce Coward wrote: My problem is lifting the data up into a structure or class
It's just the same, instead of String you use your own class. Here[^] is the top link Google offers, you can work through this tutorial to get an understanding of Hashtable basics, and then use the same code with your custom class as the content. Remember that a string is just a class in C#.
|
|
|
|
|
Hi Richard,
Thank you for your continuing patience...
I have spent quite a time with that link yesterday and am happy with it's basic message. I appreciate that string is only a class but my problem comes when I try to build my small class and store it in the Hashtable. I can do that and by single stepping I can see my two data records be added to the hashtable. I notice that the hashtable seems to add both records but put the second records data over the first hash position as well as the second hash posotion but I haven't chased that problem yet.
My real problem comes when I try to recover the records when I am not getting the data back. Here is my code:
namespace ConsoleApplication7
{
class Program
{
class csFPRec
{
public UInt32 uiPGN;
public UInt32 uiFrameCtr;
}
static void Main(string[] args)
{
csFPRec FPRec = new csFPRec();
Hashtable HT = new Hashtable();
Console.WriteLine("Writing Initial Records");
Console.WriteLine("Writing 0x1234");
FPRec.uiPGN = 0x1234;
FPRec.uiFrameCtr = 0x01;
HT.Add(FPRec.uiPGN, FPRec);
Console.WriteLine("Writing 0x5678");
FPRec.uiPGN = 0x5678;
FPRec.uiFrameCtr = 0x02;
HT.Add(FPRec.uiPGN, FPRec);
Console.WriteLine();
Console.WriteLine("Reading Records");
object pgnobj = new object();
pgnobj = HT[0x1234];
Console.ReadLine();
}
}
}
As you can tell I am a newbie with C# having been writing embedded C for more than 20 years.
Best regards
|
|
|
|
|
Try this :
....
FPRec = new csFPRec();
FPRec.uiPGN = 0x5678;
FPRec.uiFrameCtr = 0x02;
...
You added the same instance FPRec twice
|
|
|
|
|
Thanks Richard - that has fixed the records being the same on the hashtable.
Can you see what I am doing wrong in getting the records off the hashtable?
Many thanks, Bruce
|
|
|
|
|
Woops! - Wrong thanks. Thanks Estys.
Chers Bruce
|
|
|
|
|
...
pgnobj = HT[(UInt32)0x1234];
...
The basic Comparer is Object.Equals()
Your key value was converted (cast) to System.Int32 which does NOT equal UInt32 (I suspect)
modified on Wednesday, December 16, 2009 9:21 AM
|
|
|
|
|
Got It!
Many thanks Estys. Solved it. Really appreciate your help.
Cheers Bruce
|
|
|
|
|
Hello,
how is it possible to communicate with a Silverlight-App in a WebBrowser-Control in WinForms?
Is there also a possibility to use the same Classes (of course both need to have the same Interfaces)?
So can i return a class from the Silverlight-App into my WinForms-App? And that without JSON and JavaScript and blah?
Many thanks
|
|
|
|
|
Hi all,
There is a small problem with me, so thought to share it with all of you, thought i will find any idea, I have a window application created with C#, i want to create the functionality of taking backup and restoration of application data, i found some threads on google which r showing the process of taking backup from the database, my need is to create a backup file of application database n again restore it when needed
waiting for positive reply
thanks in advance for all your responses
Regards
Narendra Singh
(Jindal Tech Ventures)
modified on Friday, December 18, 2009 7:46 AM
|
|
|
|
|
So what's the problem?
If application uses local file, just copy to different folder
|
|
|
|
|
thats the question,
HOW
Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
|
Thanks saksida for ur helpful reply
Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
and I have little idea how to implement it...
I created a code folder, and a DeviceData class in it, with a constructor that (hopefully) constructs a local device of a variable type when it's instantiated. I don't actually know if it's possible to pass an object to a constructor and cast it to a specific object type based upon a Type parameter, but the compiler doesn't whine about it. I assume it's working. But I could be wrong...
My thinking is to add to the DeviceData class member functions that handle the Add, Edit, Delete, and View functions that encapsulate all the nasty database communication details so the rest of my program doesn't have to deal with them. I just want to pass an object of one of 5 types to this code block, specify what I want it to do with it, and forget it.
The devil is always in the details, though, and when I try to buld a function to add a new device to the database, the IDE snivels about an Identifier being required as the Add function parameter. I know that doesn't help much, so here's the constructor:
public DeviceData(int Type, object Device)
{
switch (Type)
{
case 1:
Recloser dev = new Recloser();
dev = (Recloser)Device;
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
default:
break;
}
}
I could be completely out to lunch, but I think that creates a member variable called dev of a type defined by the object type passed to it. At least, I hope so, and VS doesn't generate any nasty errors when I build the solution. Unfortunately, when I try to actually use the variable, things get ugly:
public int GetDevice(dev)
{
return 0;
}
At this point, the compiler complains that I haven't provided an identifier, and I don't know why. My intent is to instantiate the DeviceData object by passing the constructor a specific object that has been populated using a Form in another part of the program. My thinking is that this should create an instance variable, called dev, that can be filled with the field data from the passed object. The next step would be to query the database to populate the fields, then return the object to the calling Form module. I haven't a clue at this point why I'm receiving this message, though, and would appreciate any input.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
public DeviceData(int Type, object Device)
Where is return Type? This is function and if you do not want to have return type, use void
Edit: To check object for type use:
if (device is Recloser)
dev = (Recloser)Device;
This (int Type) shroud be avoided, you can make a mistake, and it the code can become unreadable
|
|
|
|