|
|
Wow,
this UniMod tool is pretty cool. That's exact what I'm looking for. But for Visual Studio and not for Eclipse.
I know there will be a graphical class designer in Visual Studio 2005. Nut I'm not sure if the class-designer will have the same possibilities like the UniMod tool?
Sincerely,
David
|
|
|
|
|
Hi,
how can i map virtual path or uri to physical path in form application(not asp.net)
Sincerely,
|
|
|
|
|
how do i query dataset with sql statement
|
|
|
|
|
|
If you've already got a populated dataset, you could do the following:
Let's say you got a DataSet (ds) with a 'Customer' Table, and you want all the customers that have a first name of 'Paul'
DataView dv = new DataView(ds.Tables["Customer"]) ;
dv.RowFilter = "FirstName = 'Paul'" ;
Now, you have records that have 'Paul' in the FirstName field, in your DataView.
Is that what you meant?
|
|
|
|
|
hmm..maybe
yes i have dataset already populated
but is there a way to execute a sql command on dataset data
|
|
|
|
|
Yes.
** To execute a stored procedure, that gets the value of an output parameter
//you need to have a SqlConnection object
SqlCommand something = new SqlCommand("StoredProcName",[sqlConnection]) ;
something.CommandType = CommandType.StoredProcedure ;
//for each paramter in the stored proc, do the following
something.Parameters.Add(@Parm1, SqlDbType.Int) ;
something.Parameters["@Parm1"].Direction = ParameterDirection.InputOutput ;
something.Parameters["@Parm1"].Value = [in this case an integer value] ;
something.ExecuteNonQuery() ;
Int32 somevalue = Convert.ToInt32(something.Parameters["@Parm1"].Value) ;
** there are many ways to deal with executing Sql Commands. You can set up a SqlCommand for dataadapters for automatically updating your dataset, you can also use SqlCommand to just execute a sql statement. Look in your MSDN help for more info on this, or search CodeProject articles ... there are lots of them on this issue.
|
|
|
|
|
You can use the Select() of a datatable...
<br />
DataSet ds = new DataSet();<br />
DataTable table = ds.Tables.Add();<br />
table.Columns.Add("Name", System.String);<br />
table.Columns.Add("Value", System.String);<br />
table.Rows.Add(new string[] {"David", "one"});<br />
table.Rows.Add(new string[] {"George", "two"});<br />
<br />
DataRow[] resultRows = table.Select("Name Like 'D%'");<br />
Hope it helps!
-Cursor
|
|
|
|
|
it helps! thx!
|
|
|
|
|
I've written a C# winform app and I'm new on C#...but I've some experience in programming...
I've some problems that I can't found anywhere a resolution...
My program is designed to have a main MDI form and a lot of MDI childs...so my questions are:
1)I create dinamically menu on MDI form and I've assigned to each of the a shortcut...but for the first element (i.e. "&File" menu than I've assigned Shortcut.CTRLF) it doesn't work...why?!?
the code is this:
void menuBuilder(object sender, System.EventArgs e)
{
MainMenu mainMenu = new MainMenu();
MenuItem file = new MenuItem();
file.MergeOrder=0;
file.MergeType=MenuMerge.MergeItems;
file.Text="&File";
file.Index=0;
file.Shortcut=Shortcut.CtrlF;
mainMenu.MenuItems.Add(file);
this.Menu=mainMenu;
}
2)I have a MDI child open correctly in my app from MDI menu (that I'll call FORM1) and I want that from FORM1, when it's loaded, to open another MDI child (FORM2) with a datagrid inside it.To do this I do this...
FORM2 newMDIChild = new FORM2();
newMDIChild.MdiParent = this.MdiParent;
newMDIChild.Show();
I suppose that in this manner I can load FORM 2 as a MDI child but it not seems to work, becouse if I tested if the window is open it doesnt works...and open another window!
2a)I try to close FORM2 when I close FORM1 but I can never do it...how can I do?!?I try everything but never works...
2b)When I do some works on FORM1, I write something on an ACCESS DB and then I'd like FORM 2(that is active too) update datagrid inside it...but I try everything but nothing work!!!I try to call a method on FORM2 from FORM1 becouse I suppose that it updates my datagrid...
The code is:
public void ReadResults()
{
OleDbDataAdapter da = new OleDbDataAdapter();
OleDbConnection con =new OleDbConnection();
OleDbCommand cmd = new OleDbCommand();
DataTable dt =new DataTable();
dt.Clear();
con.ConnectionString=<connstr>;
con.Open();
cmd.Connection = con;
cmd.CommandText = "SELECT * FROM TBL";
da.SelectCommand = cmd;
da.Fill(dt);
dataPreResult.SetDataBinding(dt,"");
cmd.Cancel();
con.Close();
}
I call this method on FORM2_Load and work fine...but if I want to reload datagrid when the FORM2 is displayed...what I've to do?!?
Help me please...I know that this are very stupid questions...but I didnt find anything everywhere that can help me...
|
|
|
|
|
You forgot to add click event & handler in your first block of code.
You can rewrite your code and add required functionality.
void menuBuilder(object sender, System.EventArgs e)<br />
{<br />
MainMenu mainMenu = new MainMenu();<br />
<br />
MenuItem file = new MenuItem();<br />
file.MergeOrder=0;<br />
file.MergeType=MenuMerge.MergeItems;<br />
file.Text="&File";<br />
file.Index=0;<br />
file.Shortcut=Shortcut.CtrlF;<br />
file.Click+=new EventHandler(file_Click);<br />
mainMenu.MenuItems.Add(file);<br />
<br />
this.Menu=mainMenu;<br />
}
private void file_Click(object sender, EventArgs e)<br />
{<br />
<br />
MessageBox.Show("Clicked");<br />
}
And i am sorry about your second queary. Because i can not figurout what you really want to achive.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
But if File menu has submenus...what event I've to set for him?
something like this...
void menuBuilder(object sender, System.EventArgs e)
{
MainMenu mainMenu = new MainMenu();
MenuItem file = new MenuItem();
file.MergeOrder=0;
file.MergeType=MenuMerge.MergeItems;
file.Text="&File";
file.Index=0;
file.Shortcut=Shortcut.CtrlF;
file.Click+=new EventHandler(file_Click);
mainMenu.MenuItems.Add(file);
MenuItem campionato = new MenuItem();
campionato.MergeOrder=1;
campionato.MergeType=MenuMerge.MergeItems;
campionato.Text="&Campionato";
campionato.Click += new EventHandler(Championship_Open);
campionato.Shortcut=Shortcut.CtrlC;
campionato.ShowShortcut=true;
file.MenuItems.Add(campionato);
this.Menu=mainMenu;
}
private void file_Click(object sender, EventArgs e)
{
}
Will works or...not?
For second question...probably I'm confused...
In brief...I've a MDI application with this MDI childs(at the moment all MDI childs are closed):
1)MDIFORM (MDI container)
2)FORM1 (MDI form child)
3)FORM2 (MDI form child)
I press a menu on MDIFORM that opens FORM1.
In FORM1 there is a texbox and 1 button(btnOk).
On keyPress event of textbox I write in a MSAccess DB what I'm writing in a table.
Then I press a button and on click event I call this method btnOk_Click:
public class FORM1: System.Windows.Forms.Form
{
private void btnOk_Click(object sender, System.EventArgs e)
{
FORM2 newMDIChild = new FORM2();
newMDIChild.MdiParent = this.MdiParent;
newMDIChild.Show();
}
}
In FORM2 I've a datagrid where I show results written before in last MSAccess table.The code is this:
public class FORM2 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
private System.Windows.Forms.DataGrid dataPreResult;
public FORM2()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.dataPreResult = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataPreResult)).BeginInit();
this.SuspendLayout();
//
// dataPreResult
//
this.dataPreResult.AllowSorting = false;
this.dataPreResult.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.dataPreResult.DataMember = "";
this.dataPreResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataPreResult.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.dataPreResult.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataPreResult.Location = new System.Drawing.Point(0, 0);
this.dataPreResult.Name = "dataPreResult";
this.dataPreResult.ReadOnly = true;
this.dataPreResult.RowHeaderWidth = 10;
this.dataPreResult.Size = new System.Drawing.Size(232, 613);
this.dataPreResult.TabIndex = 0;
//
// FORM2
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(232, 613);
this.Controls.Add(this.dataPreResult);
this.Location = new System.Drawing.Point(600, 10);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FORM2";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Load += new System.EventHandler(this.StringPreResult_Load);
((System.ComponentModel.ISupportInitialize)(this.dataPreResult)).EndInit();
this.ResumeLayout(false);
}
#endregion
public void StringPreResult_Load(object sender, System.EventArgs e)
{
ReadResults();
}
public void ReadResults()
{
OleDbDataAdapter da = new OleDbDataAdapter();
OleDbConnection con =new OleDbConnection();
OleDbCommand cmd = new OleDbCommand();
DataTable dt =new DataTable();
dt.Clear();
con.ConnectionString=<connectionstring>;
con.Open();
cmd.Connection = con;
cmd.CommandText = "SELECT * FROM TABLE";
da.SelectCommand = cmd;
da.Fill(dt);
dataPreResult.SetDataBinding(dt,"");
cmd.Cancel();
con.Close();
}
}
So now, my problems are:
1)When I push another time btnOk on FORM1 another FORM2 is showed.How can open one window?
2)if when I push MDIFORM menu's, when I open FORM1, I'll open FORM2 too, how can update datagrid in FORM2 from FORM1 when i write on FORM1 textbox?
Thanks for any ideas!
|
|
|
|
|
Instead of creating a new FORM2 everytime when the button is clicked, create a member variable of type FORM2 in FORM1, initializing it to null. In the event handler, test against null before creating the second form.
<br />
public class FORM1: System.Windows.Forms.Form<br />
{<br />
private FORM2 _secondForm = null;<br />
<br />
private void btnOk_Click(object sender, System.EventArgs e)<br />
{<br />
if (this._secondForm == null)<br />
{<br />
this._secondForm = new FORM2();<br />
this._secondForm.MdiParent = this.MdiParent;<br />
}<br />
<br />
this._secondForm.Show();<br />
}<br />
}<br />
This is just a simple fix, usually I try to have my mdi container manage my form instances.
In regards to your question regarding the second form accessing the first's textbox text, you could have the first form pass the second form a reference to itself. Again, this is much cleaner by having the MdiContainer manage interactions between child forms.
-cursor
|
|
|
|
|
Thanks for your answer...for the first question I try and it works great!
<b>And with the same method...I can close FORM2 from FORM1?</b>
For the second question, that's very important for me...could you give me an example how to solve this problem?I dont have so much experience with C# language to solve it...
Someone told me that for solve this problem I've to create a static method in FORM2 and then I can call it from FORM2 but I try but it there is an error...
the code is...
public class FORM2 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
private System.Windows.Forms.DataGrid dataPreResult;
public FORM2()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.dataPreResult = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataPreResult)).BeginInit();
this.SuspendLayout();
//
// dataPreResult
//
this.dataPreResult.AllowSorting = false;
this.dataPreResult.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.dataPreResult.DataMember = "";
this.dataPreResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataPreResult.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.dataPreResult.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataPreResult.Location = new System.Drawing.Point(0, 0);
this.dataPreResult.Name = "dataPreResult";
this.dataPreResult.ReadOnly = true;
this.dataPreResult.RowHeaderWidth = 10;
this.dataPreResult.Size = new System.Drawing.Size(232, 613);
this.dataPreResult.TabIndex = 0;
//
// FORM2
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(232, 613);
this.Controls.Add(this.dataPreResult);
this.Location = new System.Drawing.Point(600, 10);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FORM2";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Load += new System.EventHandler(this.StringPreResult_Load);
((System.ComponentModel.ISupportInitialize)(this.dataPreResult)).EndInit();
this.ResumeLayout(false);
}
#endregion
public void StringPreResult_Load(object sender, System.EventArgs e)
{
ReadResults();
}
public static void ReadResults()
{
OleDbDataAdapter da = new OleDbDataAdapter();
OleDbConnection con =new OleDbConnection();
OleDbCommand cmd = new OleDbCommand();
DataTable dt =new DataTable();
dt.Clear();
con.ConnectionString=<connectionstring>;
con.Open();
cmd.Connection = con;
cmd.CommandText = "SELECT * FROM TABLE";
da.SelectCommand = cmd;
da.Fill(dt);
dataPreResult.SetDataBinding(dt,"");
cmd.Cancel();
con.Close();
}
}
I run code and this is the error:
<u><b>'FORM2.dataPreResult' denotes a 'field' where a 'class' was expected</b></u>
I'm so confused...what I've to do?
|
|
|
|
|
Nobody else can help me?
I dont know how to solve my problem...
|
|
|
|
|
Hi,
I’m currently writing a POS (Point Of Sale) system in c# with the database stored in sglexpress (using .Net 2).
Is there any kind of framework out there for this?
I would appreciate any tips, not just code but also UML and general ideas about it.
Thanks
Carl-Johan Larsson
|
|
|
|
|
hey,
would anyone plz tell me how the 'custom treeview' is created at runtime?
as in windows form...
if i have to create the same using remoting...plz do tell
|
|
|
|
|
What do you mean by "custom treeview", and at "runtime"? Certain things can be done at runtime, but most peoples definition of a "custom treeview" can only be done by creating a nerw TreeView class.
And what do you mean by doing this same thing using remoting? What are your trying to do?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi!
I would like to disable / remove tabs from the folder properties dialog of Windows Explorer. Optionally I would also like to add a custom tab.
This is definately possible as I have seen some programs do this, but how? Is this done by changing the registry or what?
Any ideas / help welcome!
Regards!
|
|
|
|
|
Another thing...
How do I know when a folder is being accessed by the user or application. I want to verify with biometric if user can access folder!
Regards!
|
|
|
|
|
Ligblou wrote:
How do I know when a folder is being accessed by the user or application.
You don't. The FileSystemWatcher class will tell you about modifications to the files, not when someone opens them.
Ligblou wrote:
I want to verify with biometric if user can access folder!
Absolutely redundent considering NTFS security already handles this for you, but not using biometric verification. You'd need to write a file system extension to handle this. Your code would have to handle cases where the file is being accessed by a machine with biometric hardware, without biometric hardware, and access from the network, both with and without biometric ahrdware. You'd also have to write utilities to manage the biometric authentication keys. Sound like fun!?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sound like fun!?
It is! The full biometric system is in place. The folder security would be a nice add-on to the package. If I can get this working, I would also have a nice add-on for my multiple layer document encryption package using a HASP (hardware dongle). Loving modularity!!
I also thought about writing a File System Filter Driver (http://www.microsoft.com/whdc/driver/filterdrv/default.mspx[^]) to achieve this. It does seem like the best solution by far. Now, that sounds like fun!
Regards!
|
|
|
|
|
Ligblou wrote:
I would like to disable / remove tabs from the folder properties dialog of Windows Explorer
Depends on the tab your trying to turn off. This is done through group policies, not code. Click Start, pick Run, then type GPEDIT.MSC for the group policy editor.
Ligblou wrote:
Optionally I would also like to add a custom tab.
Never had to do this. But, it would problably be a Shell Extension (Google for this), and would require registry modifications to get the shell to know your extension is there.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank your for the information about a Shell Extension - I will look into it.
Regards!
|
|
|
|