|
Hi,
You can remove the Events from the AllTabs while loading and add back it again.
To remove an event.
AllTabs.SelectedIndexChanged -= new ...........
thx
amitabh
|
|
|
|
|
Hi
I am not able to execute oracle stored procedure in C# code.
requirement: execute oracle stored procedure which has 1 inout parameter in C#. and inout parameter type is string/varchar.
input: i am having a oracle stored procedure which had one INOUT parameter.
exception getting: when i am using below lines of code
---------------------------
OracleConnection con = new OracleConnection(StrConnectionString);
con.Open();
OracleCommand cmd = new OracleCommand("sapncdb.encrypt_field", con);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter inval = new OracleParameter("inval", OracleType.VarChar);
inval.Direction = ParameterDirection.InputOutput;
inval.Value = "13-4186423 ";
cmd.Parameters.Add(inval);
cmd.ExecuteNonQuery();
Response.Write("return value is "+ inval.Value);
-------------------------
i am getting invalid procedure exception. i am not able to find where the problem is..
if the above code is wrong, you please provide me correct way of fulfilling my requirement.
thanks in advance...........
Raj
|
|
|
|
|
Post the full exception plz
|
|
|
|
|
Hi Baran.
thanks a lot for your response.
here is the full exception: "object SAPNCDB.ENCRYPT_FIELD is invalid"
and the line which is giving this execption is cmd.executeOracleScalr()
but sure, this procedure is working from sql prompt.
Thanks
Raj
|
|
|
|
|
Hi all,
I can not retrive the elements from a hashtable in the same order as they are added.
please help......
Hashtable htParameters = new Hashtable();
htParameters.Add("fromDate", string.Format("'{0}'",fromDate.ToString("dd-MMM-yyyy")));
htParameters.Add("ToDate", string.Format("'{0}'",toDate.ToString("dd-MMM-yyyy")));
htParameters.Add("dtOvdDate", string.Format("'{0}'",dtOvdDate.ToString("dd-MMM-yyyy")));
htParameters.Add("dtOvdDatePrev", string.Format("'{0}'",dtOvdDatePrev.ToString("dd-MMM-yyyy")));
htParameters.Add("strAndPaid", string.Format("'{0}'",strAndPaid));
htParameters.Add("rdoFileInfoSpecific", string.Format("{0}",rdoFileInfoSpecific.Checked?"1":"0"));
htParameters.Add("SpecificFileNo", string.Format("'{0}'",txtFileInfoSpecific.Text.Trim()));
htParameters.Add("strAndFOfficer", string.Format("'{0}'",strAndFOfficer));
htParameters.Add("strAndZone", string.Format("'{0}'",strAndZone));
htParameters.Add("strCollType", string.Format("'{0}'",strCollType));
htParameters.Add("rdoStatusNID", string.Format("{0}",rdoStatusNID.Checked?"1":"0"));
htParameters.Add("rdoStatusBankOpen", string.Format("{0}",rdoStatusBankOpen.Checked?"1":"0"));
htParameters.Add("chkOvdVal", string.Format("{0}","0"));
htParameters.Add("rdoRepTypeAllDet", string.Format("{0}",rdoRepTypeAllDet.Checked?"1":"0"));
when retrieving.....
they comes in different order
if (parameters != null && parameters.Count > 0)
{
foreach (string parametername in parameters.Keys)
{
SqlParameter param = new SqlParameter("@" + parametername, parameters[parametername]);
Cmnd.Parameters.Add(param);
}
}
plz reply asap
mir
|
|
|
|
|
This is in the nature of the hashtable. all elements are sorted by the hash of the key as mention here:
http://msdn.microsoft.com/en-us/library/system.collections.hashtable.aspx[^]
"Represents a collection of key/value pairs that are organized based on the hash code of the key."
Use List< KeyValuePair< T,T > > for that unless you need an efficient by-key retrieval
And please post code that compiles for others, like keep consistent field names (what is parameters?) and post code that works without rewriting all of your format variables.
modified on Thursday, June 11, 2009 1:58 AM
|
|
|
|
|
I can give the rectangle of a control by bounds.but I don't know how get the visble rectangle when a control not display whole.
Rectangle r = ctrl.Bounds;
ctrl.DisplayRectangle;
modified on Thursday, June 11, 2009 12:25 AM
|
|
|
|
|
What do you mean by not displayed whole?
Windows keeps track of what parts of a control need to be repainted and joins them together into a 'clip rectangle' which is passed the the OnPaint handler.
Regards,
Rob Philpott.
|
|
|
|
|
Thanks!
I have two container controls like follow "a" and "b"
┌────┐
| |
| a |
| |
└────┘
┌───────┐
| |
| b |
| |
└───────┘
b is bigger than a
And I drag b into a,so b only display the visible area and I want to get that,not b.bounds
┌────┐
| a┌──┤
| | |
| | b |
└─┴──┘
how can I get it?
|
|
|
|
|
Ok,I get it,follow
ctrlP = ctrl.Parent;
Rectangle r = ctrl.Bounds;
Rectangle rP = new Rectangle(0, 0, ctrlP.Width, ctrlP.Height);
r.Intersect(rP);
but I have new issue,I want to draw the border of the "display bound"
Graphics g = ctrlP.CreateGraphics();
Pen p = new Pen(Color.Red);
p.Width = 1.5f;
g.DrawRectangle(p, r);
g.Dispose();
It draw the top and the left line fine,but the right and the bottom line were clear,because OnPaint event of ctrl?
and this method was fired in Form_Paint(object sender, PaintEventArgs e).
|
|
|
|
|
Yup, that looks good using the intersection of the two rectangles. The right and bottom line are probably not appearing because they're outside the clip rectangle. The Rectangle method draws a rectangle where the dimensions you supply are the area inside and not including the lines.
Try deflate() ing the rectangle a bit and you should see all four sides.
Regards,
Rob Philpott.
|
|
|
|
|
Thanks again!
Rob Philpott wrote: The right and bottom line are probably not appearing because they're outside the clip rectangle
I use the Inflate(-2, -2) to make sure the Rectangle was inside the clip rectangle,but they're still not appearing.
follow is the test code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace draw
{
public partial class Form1 : Form
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel1.SuspendLayout();
this.SuspendLayout();
this.panel1.Controls.Add(this.groupBox1);
this.panel1.Location = new System.Drawing.Point(192, 141);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 100);
this.panel1.TabIndex = 0;
this.groupBox1.Location = new System.Drawing.Point(91, 43);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(200, 100);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(674, 358);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.GroupBox groupBox1;
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Control ctrl = groupBox1;
Control ctrlP;
ctrlP = ctrl.Parent;
Rectangle r = ctrl.Bounds;
Rectangle rP = new Rectangle(0, 0, ctrlP.Width, ctrlP.Height);
r.Intersect(rP);
r.Inflate(-2, -2);
Graphics g = ctrlP.CreateGraphics();
Pen p = new Pen(Color.Red);
p.Width = 1.5f;
g.DrawRectangle(p, r);
g.Dispose();
}
}
}
|
|
|
|
|
I think the cause is the graphics,which belong to panel1(the parent of groupbox1),we drawed the rectangle on the panel1 but it just under the groupbox1.So the rectangle we drawed were cover by the groupbox1.
|
|
|
|
|
I'm not sure I like the look of this. You appear to be painting on the groupbox in the paint event of the form. Really you should only use that to paint areas of the form that don't have controls on them. You'd need to do that paint in the groupbox's paint event, not the form one.
Likelyhood is that the groupbox paints itself immediately after the form. Do you get flicker at all?
Regards,
Rob Philpott.
|
|
|
|
|
change the p.Width = 1.5f; to p.Width = 10f;
you can see the left and top line were drawed.
|
|
|
|
|
Hi,
I want to ask a question about GUI designing in C#
I have a project to do , and it has only a few forms to show
and it is very important to have a very special and also very beautiful GUI
I want to know is it better to have a GDI+ and/or have a System.Drawing or/and
it is better to have a custom Control
help me please
thank you all
|
|
|
|
|
cppwxwidgetsss wrote: I want to know is it better to have a GDI+ and/or have a System.Drawing or/and
it is better to have a custom Control
WPF is a good choice if you need beautiful UI.
|
|
|
|
|
...f is a Form
Control t_ctrl;
for (int i = 0; i < f.Controls.Count; i++)
{
t_ctrl = f.Controls[i];
TreeNode t_tn = new TreeNode(string.IsNullOrEmpty(t_ctrl.Text) ? t_ctrl.Name : t_ctrl.Text);
t_tn.Tag = t_ctrl;
self.treeView1.Nodes.Add(t_tn);
addNode(t_ctrl, t_tn);
}
...
private static void addNode(Control ctrl, TreeNode tn)
{
Control t_ctrl;
for (int i = 0; i < ctrl.Controls.Count; i++)
{
t_ctrl = ctrl.Controls[i];
TreeNode t_tn = new TreeNode(string.IsNullOrEmpty(t_ctrl.Text) ? t_ctrl.Name : t_ctrl.Text);
t_tn.Tag = t_ctrl;
tn.Nodes.Add(t_tn);
if (t_ctrl.Controls.Count != 0)
{ addNode(t_ctrl, t_tn); }
}
}
but is not full,some controls not got into the treeview1.such as ToolStripMenuItem.
somebody can give me some tips or advises.Thanks!
|
|
|
|
|
You should use a foreach, and you should write a recursive method, because some controls, contain controls.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Thanks for your reply
I had already use the recursive method-->"addNode(Control ctrl, TreeNode tn)"
|
|
|
|
|
Controls inside a tool strip aren't available from the Controls property, you need to use the Items property instead.
|
|
|
|
|
So if I want to make it, I need to consider all those special controls,
It's not a easy thing,right?
Did anybody have idea about how display all controls in winfroms at runtime like vs2005 doc outline tool in designtime?
|
|
|
|
|
hwswin wrote: It's not a easy thing,right?
As there's no common interface to access child controls, I'm afraid not.
|
|
|
|
|
Does any one know of a Development tool that can create Command Shells or loadable modules in windows for C# for a server.
|
|
|
|
|
Hi all
I'm creating a web browser in C# and i've pretty much got what I needed and I keep getting stuck on one thing. When I'm browsing the web in my new browser and stumble upon a link that opens a new page in a new browser, or in a new tab or whatever, it opens that new page in internet explorer! lol. How can I stop this? It's really getting on my nerves, but it's making me laugh at the same time... I want to do something like this (and yes, i know this code will never work :p):
if Link is trying to open new page in new tab or window
then open that new page in a new tab in the current window.
... I know how to create new tabs, add a new webbrowser control to the new tab etc, i just don't know how to get those particular links to open up in a new tab. Does anybody have any ideas as to how I might go about doing this? I have looked on msdn and couldn't find anything. I also tried google and found a few links but then led me to something completely unrelated.
thanks,
jase.
modified on Thursday, June 11, 2009 1:44 AM
|
|
|
|