|
Please don't cross post
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hide the Active column on the gridview
Create a new column not bound to a db field.
Use the ItemDataBound event to change the new column based on the contents of the hidden column
|
|
|
|
|
Hello,
I am reading values from an Access Database with an OleDbDataReader. I am using the following command:
myCommand.CommandText =
"SELECT FolderName, SecurityGroupName " +
"FROM tblFolderSecurityTemplateInternal";
I am then putting this data into a dynamic array. Here is my problem. I need a way to have the DataReader output to a multi dimensional array. MyReader only takes one value in the array: Ex: subitems1[j,k] = myReader1[j].ToString(); Ultimately, I want to set subitems[j] = to a new variable called FolderNm and subitems[k] = to a new variable called SecurityGroupNm.
OleDbDataReader myReader1;
myReader1 = myCommand.ExecuteReader();
int nFields1 = myReader1.FieldCount;
while (myReader1.Read())
{
// Create an array of subitems
String[] subitems1 = new String[nFields1];
for (int j = 0; j < nFields1; j++)
{
for (int k = 0; k < 2; k++)
{
subitems1[j, k] = myReader1[j].ToString();
}
}
myReader1.Close(); //Close the reader.
|
|
|
|
|
I may be wrong but, aren't you just duplicating the functionality of a DataSet ? I can't believe the increased overhead would be that dramatic.
|
|
|
|
|
Please don't repost questions this quickly. It's plain rude.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
My application has one MDIparent (say MDIparent.cs) and a tool form (say mainform.cs).
A text box in the mainform.cs takes some strings as input and displays the resulting data on the form. There are thousands of strings that can be entered in the input field that give different data for that particular string.
After entering my first string in the mainform, i open a "new" form in the MDIParent (File-->New) to give me another window of form so that i can calculate data for a different string.
However, when i do that, the application seems to be over-writing the data of the new window onto the first form and vice versa.
My goal is to keep keep the data different for different strings, separate.
Is it a problem with MDIParent or form?
Can anyone give me an idea how can i make sure that the form only subscribes to the proper event on itself alone?
Thanks
|
|
|
|
|
Hello,
I am reading values from an Access Database with an OleDbDataReader. I am using the following command:
myCommand.CommandText =
"SELECT FolderName, SecurityGroupName " +
"FROM tblFolderSecurityTemplateInternal";
I am then putting this data into a dynamic array. Here is my problem. I need a way to have the DataReader output to a multi dimensional array. MyReader only takes one value in the array: Ex: subitems1[j,k] = myReader1[j].ToString(); Ultimately, I want to set subitems[j] = to a new variable called FolderNm and subitems[k] = to a new variable called SecurityGroupNm.
OleDbDataReader myReader1;
myReader1 = myCommand.ExecuteReader();
int nFields1 = myReader1.FieldCount;
while (myReader1.Read())
{
// Create an array of subitems
String[] subitems1 = new String[nFields1];
for (int j = 0; j < nFields1; j++)
{
for (int k = 0; k < 2; k++)
{
subitems1[j, k] = myReader1[j].ToString();
}
}
myReader1.Close(); //Close the reader.
|
|
|
|
|
Hello,
How can I throw event in unmanaged code (cpp) and catch it in managed code (c#) ?
thanks
|
|
|
|
|
Can the C++ code be compiled as C++/CLI? If so, you can define events there like any other managed language.
|
|
|
|
|
you can pass a delegate to unmanaged code, accept it as a function pointer and call it
when you feel like it.
The delegate could then invoke the event using purely managed code.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
With the help of Yesterday`s discussion[^] and this[^] I worked am getting all the type in system.Windows.Forms
Code:
<font>AssemblyName name = new AssemblyName("System.Windows.Forms");
name.CultureInfo = new System.Globalization.CultureInfo("");
name.SetPublicKeyToken(new byte[] {0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89});
name.Version = new Version(2, 0, 0, 0);
Assembly a = Assembly.Load(name);
Type[] types = a.GetTypes();
foreach (Type t in types)
{
if (t.Namespace == "System.Windows.Forms")
listBox1.Items.Add(t.ToString());
}
MessageBox.Show(listBox1.Items.Count.ToString());
</font>
I didnt Understand the meaning of
<br />
name.SetPublicKeyToken(new byte[] {0xb7,0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89});<br />
Can you Explain This
Thanks & Regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
When signing assemblies a private and public key are generated by the company distributing the assembly. The company keeps the private key in a secure location. The public key is sent along with the assembly. When the company signs an assembly with the private key, third party users can then use the public key to verify that the assembly has not changed. Basicaly it allows users to detect if someone has tampered with the assembly.
Now, assemblies have four pieces of information to describe their full name. They are Name, Version, Culture, and PublicKeyToken. The PublicKeyToken is the public key which is used to validate that the assembly has not changed.
Now, it is possible to change the assembly and simply sign it will a different private key and update the PublicKeyToken appropriately. But in this case, you application is typically tied to the assembly using the full name (which include the correct public key). So in this case your application won't open the assembly because the public key is not correct.
So, long story short. If you excluded the public key then the assembly would still load, but then someone could drop in a "hacked" version of the assembly and your application would happily load it.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Thanks and regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
I have one more problem
How can I distinguish controls in any namespace / dll
Thanks & Regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
You're going to have to explain what you mean by this. What do you mean by "distiguish"?? And in "any namespace"?? What are you trying to do??
|
|
|
|
|
I am creating an article for code project
which is a theme applier for windows forms
we have an xml file with details of theme (Some what like the Concept of CSS)
this will contain 4 projects
1>Control Resizer : it will resize most of the controls at run time (completed)
2>Auto Control Resizer: this will resize all the controls on run time when the form is resized or the screen resolution is changed (completed)
3>UI Applier : this will read the theme from the xml and apply it to the respective forms (Almost completed )
4>UI Maker : this will make that XML file.-> I want to implement the idea that user can select any control at run time (for example a button) he can select that control even if it is custom control, then the control will be shown on the screen, with its property grid. he can modify control at run time and see the effects of the modification on the run time. (partially completed)
now the problem is that I need to get a list of all such controls so that user can select the control and that control can be created at run time.
Thanks and Regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
I'm assuming you want the types from a given assembly that derive from System.Windows.Forms.Control. If so, then once you have the assembly loaded you can run the following code:
foreach (Type type in assembly.GetTypes()) {
if (type.IsSubclassOf(typeof(Control))) {
}
}
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Great
the list is pretty much clear But there are still some extra entries
Like
System.Windows.Forms.Application+MarshalingControl
System.Windows.Forms.Application+ParkingWindow
System.Windows.Forms.AxHost
System.Windows.Forms.UpDownBase
System.Windows.Forms.UpDownBase+UpDownEdit
System.Windows.Forms.UpDownBase+UpDownButtons
System.Windows.Forms.DomainUpDown
System.Windows.Forms.PropertyGrid+SnappableControl
System.Windows.Forms.SendKeys+SKWindow
System.Windows.Forms.StatusStrip+RightToLeftLayoutGrip
System.Windows.Forms.ToolStripComboBox+ToolStripComboBoxControl
System.Windows.Forms.ToolStripOverflow
System.Windows.Forms.ToolStripPanel+FeedbackRectangle+FeedbackDropDown
System.Windows.Forms.ToolStripScrollButton+StickyLabel
System.Windows.Forms.ToolStripTextBox+ToolStripTextBoxControl
System.Windows.Forms.PrintControllerWithStatusDialog+StatusDialog
Thanks & Regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
It really depends on what you are looking for, but I'm assuming you want only public and non-abstract controls, which would look like:
foreach (Type type in assembly.GetTypes()) {
if (type.IsSubclassOf(typeof(Control)) &&
type.IsPublic &&
!type.IsAbstract) {
}
}
I would recomment using Reflector[^] to help further filter the list. The Type class has lots of properties that can be used.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Thanks
if you want to see what I am doing you can see this[^]
Thanks and Regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
I want to search for an line in a .txt file, if there are text then go.
i tryade this:
string[] lines = System.IO.File.ReadAllLines(".txt");
if (lines[0] == "#")
{
but it doesn´t work. Do you have some suggest?
Tnx!!;););)
|
|
|
|
|
Try a foreach-loop and match the indexed string against your searchpattern.
For instance:
string searchPattern = "#";
foreach(string line in lines)
{
if(line.Equals(searchPattern))
{
}
else
{
}
}
You could also use String.Contains(searchPattern) .
-Larantz-
|
|
|
|
|
Are you simply searching for lines that begin with "#"?
If so, then code is:
foreach (String line in lines) {
if (line.StartsWith("#")) {
}
}
Basically, you are missing the loop that iterates over each line read..
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
ok.. but i have to give out line nr can i do like this?
foreach (String line in lines)
{
if (line[20].StartsWith("#"))
{
or d oi have to change the hole code?
|
|
|
|
|
To get the line number, you would need to either keep a counter, like so:
Int32 lineNumber = 0;
foreach (String line in lines) {
lineNumber++;
}
or you could switch to the for[^] loop (instead of a foreach[^] loop), like so:
for (Int32 i = 0; i < lines.Length; i++) {
String line = lines[i];
Int32 lineNumber = i + 1;
}
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|