|
thanks for your reply.
You are probably correct in saying that using managed C++ extensions would be easier, but I haven't looked at MC++ enough to know that. The problem is that there is already a sizeable part that has already been written (by other people) that uses calls into the crypt32.dll and the amount of effort and time to change the existing code would be much greater than carrying on in this manner, because adding the call to CertVerifyRevocation is the only extension to the current implementation.
What I was looking for were some resources to explain the mapping of types between managed and unmanaged code, and how to manage memory correctly to use the unmanaged functions (IntPtr usage, Marshalling memory etc...)
Thanks.
Jamie.
|
|
|
|
|
A lot of this just comes with experience with both unmanaged and managed languages. You can read Platform Invoke Data Types[^] in the .NET Framework SDK, but you need to read through that whole Interoperating with Unmanaged Code[^] section to really understand it (and experience, again).
Like I said before, the CertVerifyRevocation accepts one struct but this struct, in turn, uses many levels of nested structs, which the marshallers that the CLR implements/uses does not support. One solution would be to flatten the structures, but you must make sure that each struct's cbSize (as it's typically called - just the size of the struct in bytes) is still set so that only that amount of memory is read as the struct.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to let the decision tree accepts string varaibles as a target but the problem that the ID3 algorithm only accepts boolean varaibles as a target by default so i want to now how to overcome this problem
Cherif
|
|
|
|
|
Why don't you try the message board on the article, ID3 Decision Tree in C#[^]? I've already tried ponting you toward the solution, but if you have a specific problem with article content then you should ask on that article's message board.
If you've asked this question far too many times and noticed that you haven't always got the reply you wanted, which probably indicates the regulars here that are answering the questions are not familiar with the ID3 decision tree algorithm. If you have a specific problem doing something in C# that doesn't relate to that algorithm, then this is the place to ask.
Finally, I did reply to your email with a simple solution: define the property as a string property. If you need to convert a boolean to a string, then simply use the ToString method. There's also lots of other classes and methods that can help you convert from one to the other and it's all documented in the .NET Framework SDK, like the Convert class.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can I implement in C# a structure similar to that of Windows Explorer (the tree structure) but using other elements than directories and files.
Thank you in advance for your answer.
Best regards,
Cristina
|
|
|
|
|
cristina_tudor wrote:
How can I implement in C# a structure similar to that of Windows Explorer (the tree structure)
I am assuming you mean a user interface structure (control).
The System.Windows.Forms.TreeView provides this functionality.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
Hello, Sir and Madam
Please help me design a database for world soccer.
World soccer has many tournaments, teams and players.
One team stay in more than one tournament.
One player can transfer from a team to the other.
Also thinking about red card, yellow card, goal, player position, club team, country team, etc.
Thank You.
Sorry for bad English.
|
|
|
|
|
god4k wrote:
Please help me design a database for world soccer
Is this a homework question???
You should design the initial database yourself. If you are still having problems post a more specific question along with the part of the design that is causing problems and maybe someone will help let you know how to correct any problems.
At the moment, your question is also too vague: "Also thinking about red card, yellow card, goal, player position, club team, country team, etc."
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
I mean database structure, tables and relations
This is not homework.
Thank You.
|
|
|
|
|
Okay, I realise you mean structure, tables and relations. The number of objects you mention is quite large, also not every one is an expert on football (soccer) so you really need to explain the rules of how each of these objects relate to each other. The explanation will help you understand the relations better your self.
As a starting point:
A team has many players
A team plays in many tournaments
A tournament has many teams
A player can play for many teams (are you including international teams?)
From this small subset we can create a structure like:
+------------+ +------+ +--------+
| |\ /| |\ /| |
| Tournament |-----| Team |-----| Player |
| |/ \| |/ \| |
+------------+ +------+ +--------+
Now, most relational database systems don't accept a many-to-many joins directly so these m2m joins have to be expanded:
+------------+ +----------------+ +------+
| | /| |\ | |
| Tournament |-----| TournamentTeam |-----| Team |
| | \| |/ | |
+------------+ +----------------+ +------+
So the keys on your the above tables are:
Tournament: TournamentID
TournamentTeam: TournamentID, TeamID
Team: TeamID
The TournamentTeam Table contains a composite primary key (i.e. one that is made up of more than one field). It also contains two foreign keys TournamentID to link to the tournament table and TeamID to link to the Team table.
Does this help you get started?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
|
Hi,
How do I set background color for status bar?
Direct property not available.
Thankx
Priya
|
|
|
|
|
You'll have to paint the StatusBar or StatusBarPanel (whichever you use) yourself. See the StatusBar.DrawItem event documentation in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hai there,
In my project i have a user control that will display colordialogbox.
At a time user will create n- number of usercontrol and will choose different color for all different control. the color may defined or custom. My aim is to store all selected color to database.
How it is possible.
See, some times i will get user selected colors as Red,green,Blue etc. why because these colors are in color struct.
but if i choose color that is not in color struct that will give some values like this [A122,R=654,G=232 B=233]. How can i convert this values to meaningfull names that end user can identifiy easily ?
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
sreejith ss nair wrote:
My aim is to store all selected color to database. How it is possible.
You could use int myIntColour = System.Drawing.ColorTranslator.ToWin32(myColour); to convert the colour to an int and store that value in the database. You can then use System.Drawing.ColorTranslator.FromWin32(myIntColour); to convert back to a .NET object
sreejith ss nair wrote:
but if i choose color that is not in color struct that will give some values like this [A122,R=654,G=232 B=233]. How can i convert this values to meaningfull names that end user can identifiy easily ?
If the colour is not already available as a named colour then you'll either have to make up some names yourself (a big task as there are 16.7million possible combinations) or get the user to name their own custom colours.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
sreejith ss nair wrote:
but if i choose color that is not in color struct that will give some values like this [A122,R=654,G=232 B=233]. How can i convert this values to meaningfull names that end user can identifiy easily ?
First of all, you can't use 654 for the red component. The only legal values are 0 through 255. Second, you should use a color picker - which many are available from this site and there is a way to use the ColorEditor that you see in the PropertyGrid for color properties like ForeColor and BackColor - which makes it easy for a user to pick a color. If you want to name these colors as Colin mentioned you'll have problems since the Color methods don't support user-defined names, so you'll have to come up with your own implementation, such as implementing read-only properties with pre-defined Color instances like the named colors already on the Color struct.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a listbox.
I want to get the selected item of the list and assign it as a hatchstyle to a variable
ie. hatchstyle = listbox selected item
please help
"joel"
|
|
|
|
|
See Enum.Parse . Assuming your ListBox contains a list of strings with corresponding HatchStyle enum member names, you can use something like this:
string value = listBox1.SelectedItem as string;
if (value != null)
{
try
{
HatchStyle hs = Enum.Parse(typeof(HatchStyle), value);
}
catch
{
MessageBox.Show("Invalid hatch style!");
}
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
this works
HatchStyle htch = (HatchStyle)this.listBox1.SelectedItem;
I dont know how but it does.
|
|
|
|
|
I have created an Windows Invoice programme in C#, with Visual Studio 2003, which has 4 textBoxes by 15 line items.
The 4 boxes are Description, Quantity, Rate, and Amount.
How do I immediately show the Amount as calculation with Quantity * Rate.
I currently can only show the calculated Amount after Saving or Updating the Invoice.
All previous help from this site has been excellent.
Thank you, in anticipation.
Fred S. Parker
Email: fred@fsparker.com.au
|
|
|
|
|
Check into the TextChanged event. It'll fire whenever the text changes in a textbox. You could probably get away with one function handling the TextChanged event for all of your Quantity and Rate textboxes. Then it's just a simple matter of Amount = Quantity * Rate.
RageInTheMachine9532
|
|
|
|
|
Dave,
Thank you for your prompt reply.
Can you point me to a pratical sample of your suggestion.
Regards,
Fred.
Fred S. Parker
Email: fred@fsparker.com.au
|
|
|
|
|
Out of curiousity, why not use a DataGrid and bind that to either a DataSet or DataTable , or to an array of some class that you could implement? The DataTable already supports expressions like this and doesn't have to be tied to a database to be usable.
It's just a thought. Dave's right, though, just handle one of the events when the TextBox loses focus and update the product of the two TextBox es in your calculated TextBox . TextChanged is probably best for this, but keep in mind that it isn't fired till the TextBox loses focus.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath.
Thank you for your suggestion, but a DataGrid is not appropriate.
I have 3 other projects that require calculations, one which has a combination of 60 TextBoxes that require calculations.
Regards,
Fred.
Fred S. Parker
Email: fred@fsparker.com.au
|
|
|
|
|
Heath Stewart wrote:
TextChanged is probably best for this, but keep in mind that it isn't fired till the TextBox loses focus.
Text changed is fired whenever text is changed in the control (by either programmatic modification or user interaction). I think, you tought about Validating event which is truly raised when control loses focus.
But talking about textboxes and calculations...
You can:
1. Create data table as spoken above. But - do you want two way calculations? It means if user enter Rate and Amount, should the quantity be "reverse calculated" or not? In this case, use RowChange/ColumnChange evenmts to calculate values rather the expressions. There is one more disadvantage: You will need to bind 15 rows of the table at a time. I have been playing with it some time but not developped efficient way.
2. Create some calculator class, which can be bound with textboxes (or whatever control you want) and directly operate on datasource you want. I think, this method is much better, because you can validate data in the fly (esp. when input is bound to textbox), and calculating logic may be much more complex when you'll need it.
|
|
|
|