|
Do you have an internal WinModem? These sometimes create a virtual COM port which will not be shown in the Device Manager. Take a look at the modem-properties in the configuration-screen.
I are troll
|
|
|
|
|
Yes, you are right.
I have hdaudio data fax modem, its port is com3, and some ports are in use (com5, com6)
But com3 is not in use.
When I pluged usb-serial adaptor in notebook, com3 is appearing under "Ports". After, I can use this port.
If modem is using or reserved (but com3 not in use) the port, how did adaptor take this port?
So, How can I get correct port list (without com3)?
Thanks...
I want to fly but I don't have wings
|
|
|
|
|
enginço wrote: So, How can I get correct port list (without com3)?
You can give System.Management a try, I have used it before to enumerate hardware. I don't know for sure whether virtual com-ports are included, and I can't test it on my own machine (at least not without installing a new com-port). You'd need to add a reference to the assembly "System.Management" to use this functionality. The code would be something like this;
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("SELECT Name FROM Win32_SerialPort");
foreach (ManagementObject mo in searcher.Get())
Console.WriteLine(mo.GetPropertyValue("Name"));
Console.ReadKey(); Alternatively, you could scan the registry. Open RegEdit and search for the friendly name of the COM-port
I are troll
|
|
|
|
|
i am using binding navigator in my application
it throw error while updating to many fields
but working fine for insert
why
how do i call addnew programmaticaly
|
|
|
|
|
hi friends,
could you please let me know how do I get the index of checkedlistbox If I pass itemtext(string)?
thanks,
Jeet
|
|
|
|
|
loop through the items and compare the text value - select the item and bail out of the loop.
If you are binding use the same field for the DisplayMember and the ValueMember
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All,
I want to do a process on specific tab. So I do similar to this.
private void AllTabs_SelectedIndexChanged(object sender, System.EventArgs e)<br />
{<br />
if(AllTabs.SelectedTab == tabMyTab)<br />
MessageBox.Show("FOUND");<br />
}
On click the specific tab, message is pop-up. But the issue is, message also pop-up on the form load as well. I don't want to do that. Can someone help me to sort out this.
Thanks a lot
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Create a form level bool
bLoading = true;
In your selected indexchange event do the following as you first line of code
if(bloading)
{return;}
the last thing in the form load method set bLoading to false
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
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.
|
|
|
|