|
mmm.. I don't know, I'll see if i look into it.
this documentation is from MSDN (the one which comes with Visual Studio.NET Enterprise Edition).
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Andres Manggini wrote:
this documentation is from MSDN (the one which comes with Visual Studio.NET Enterprise Edition).
Sorry,Which documentation you mean?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Microsoft Visual Studio.NET Documentation.
a blue ballon icon, with a question mark inside of it
Regards,
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
ControlStyles is an enumeration. Each control has one and can be set via the SetStyles() protected method on a control. You pass in the flags you want to set/unset and pass in true or false to tell whether it should set that style.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Can you give an example please?
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Usually you set it in the controls constructor so
public class myDataGrid : DataGrid {
public myDataGrid() {
SetStyle( ControlStyles.StandardClick, true );
}
}
Now the Double click events will fire according to the documentation.
I can't tell from the documentation if the DoubleClick event will fire for everything now or if it was supposed to indicate the standard event will fire.
In anycase you should be able to hook into the DoubleClick event yourself and do some calculating to determine which cell is being clicked on.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
hmmm,So I have to use subclassing,I never do that in C#,Can you tell me how?Is this right:
Create new class derived from DataGrid class and handle DoubleClick() event.
Then I don't know how to use it in my application.
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Yep thats correct, using a subclassed control is easy; instead of saying System.Windows.Forms.DataGrid, you refer to myDataGrid
Thats all there is to it.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
I am going to try this again. I have a dll which I can call in VB6 with no
problem. I am trying to convert all my code to c# but I am running into a
big problem with accessing dlls'.
The first time I posted this question no one could answer why I was getting
the error, so I will ask what is the error exactly. I have researched all
the wox books, microsoft and cannot find out what this error actually means
to give me a starting point for my resolution.
Here is my code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace WindowsApplication20
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
[DllImport("Mydll.dll")]
public static extern int myOpen(string sFileName);
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(32, 88);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(408, 20);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "textBox1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(32, 48);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(104, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(32, 120);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(400, 20);
this.textBox2.TabIndex = 2;
this.textBox2.Text = "textBox2";
//
// label1
//
this.label1.Location = new System.Drawing.Point(32, 160);
this.label1.Name = "label1";
this.label1.TabIndex = 3;
this.label1.Text = "label1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(496, 373);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label1,
this.textBox2,
this.textBox1,
this.button1});
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "C# Corner Open File Dialog" ;
fdlg.InitialDirectory = @"c:\" ;
fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*" ;
fdlg.FilterIndex = 2 ;
fdlg.RestoreDirectory = true ;
if(fdlg.ShowDialog() == DialogResult.OK)
{
label1.Text = myOpen(fdlg.FileName).ToString();
}
}
}
}
I am getting into the DLL with no problem, but once the call is made i
receive the:
"value null was found where an instance of an object was required"
The dll basically opens the file and will return a number 0-99, 0 meaning
unsuccessful and non 0 is successful.
I know I can open file in c# many different ways but I have several other
calls in the dll I use, but this is the simplest to diagnose.
Here is the header for vb6:
Declare Function myOpen& Lib "mydll.DLL" Alias "MYOPEN" (Filename$).
Any help would be appreciated, this is very frustrating.
Thanks,
Bob
|
|
|
|
|
Hi,
I'm writing a console app and I need to clear the console, or reposition the cursor at the top left of the console so I can overwrite the current display.
I've been looking but I can't find a way to do this...
Can anyone help me?
Chris.
|
|
|
|
|
Either it is a remarkably small world, or you are not the Chris Masiero that I am thinking...
--
David Wengier
TAC ad gone wrong: "Don't fool yourself, you're a bloody idiot."
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Hehe, It's just a very small world
- Chris 'eclipsed' Masiero
|
|
|
|
|
How to generate a guid (global Unique Identifier) in C#? Thanks
chris#
|
|
|
|
|
I know this one:
Marshal.GenerateGuidForType
[C#]
public static Guid GenerateGuidForType(
Type type
);
Returns the GUID for the specified type, or generates a GUID using the algorithm used by the Type Library Exporter (TlbExp.exe).
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Guid.NewGuid();
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
James T. Johnson wrote:
Guid.NewGuid();
Boy. That is sure easy!
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
I have created a databinding DataList, and OnSelectedIndexChanged event, I have a SelectedItemTemplate to show additional two lines of details right below the row Selected, which makes it look like expandable/collapsible tree. But I can only expand one row at a time. What I want is to have an ability to expend more rows. ( like treeview control does). Can datalist support multiple selections?
If someone is interested in this question, give me an email, I will send you an image of what I have now.
chris#
|
|
|
|
|
The ListBox gets populated by SQL server database (databinding), I need to support multiple selection so that I can retrieve all the selected values in the ListBox and send them back to database as sql statement and then get the result back to show in the web page.
My question is: How can I construct the sql statement with parameter (array) that reflect those selections in ListBox? e.g. In sql statement " Where id=@id" works for single parameter, if id is type of int, @id is also type of int. Now I have an id array holding the selected id from ListBox. What will be the array type. How can I construct sql ?
Chris#
|
|
|
|
|
You'll have to create an "or" separated parameter list for the Where
Taking your example:
"... Where id=1 or id=2 or id=3 "
So, I would say a for statement iterating through the array, getting each value and adding "or id=" + value
Something along theselines..
I'm not sure if this is clear enough, if you have any questions about it, i'll try to clarify.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Thanks! I will try your way. I just posted another 2 questions. You may have idea too! Thanks again!
|
|
|
|
|
Andres should work but you can shorten it down by using the "IN" keyword.
WHERE id IN ( @id1, @id2, @id3, ... ) I'm pretty sure you'll have to use dynamic sql generation if you try this in a stored proc though.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
I created a method to generate sql string "where clause", and then append the string to the first part of sql. It works fine. Thanks for both of your help.
chris#
|
|
|
|
|
A post on the lounge reminded me of something I've been meaning to look up for a while: benchmark tests on .NET.
Does anyone know of any benchmarks available, and, would anyone be interested in porting some standard benchmarks to C#, VB.NET and/or Managed C++?
cheers,
Chris Maunder
|
|
|
|
|
Here (MSDN - Microsoft)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/Dnbda/html/Bdadotnetarch13.asp
You'll find a few perfomance comparison like Data Acces Techniques or Transaction Control.
I would be interested, what kind of benchmarks do you have in mind ?.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|