|
Call it async (using the Begin... call generated by the proxy).
|
|
|
|
|
Hi,
I Want By OOP Convert Forms To User Control.
|
|
|
|
|
moh_monir wrote:
I Want By OOP Convert Forms To User Control.
Thats a little vague, can you give more details about what you are trying to achieve.
At the simplest level. Create a new user control and cut and paste your Forms contents onto the user-control. Then you can use the user-control on the form.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Your Solution is Obvious, but It will be so long to cut and past 25 forms (incredable) i need a solution using OO this is my main task.
by another way:- i have a 25 forms and i wanna make all of them user control
if u can help me i'm waitting for ur replay
|
|
|
|
|
moh_monir wrote:
Your Solution is Obvious, but It will be so long to cut and past 25 forms (incredable) i need a solution using OO this is my main task.
by another way:- i have a 25 forms and i wanna make all of them user control
I haven't tried this but in theory, you should be able to change your base class from Form to UserControl.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Thank U Michael I Think This Is The Solution.
|
|
|
|
|
Forms ARE Controls already. This is the Form classes inheritance tree:
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ContainerControl
System.Windows.Forms.Form
UserControl also has the same inheritance tree, so I don't get why you would want to change a form to a UserControl since both are just custom ContainerControls. What's the advantage? What are you trying to do?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
The Idea:- If I Have 25 Forms and I want To put Eact Five Forms In One Form In The Tab Control And It's Not Allowed To Make Nested Forms, So I Will Use The User Control Instad Of Forms. Now I Want To Convert This Forms To User Control By Easy Way.
The Solution: change the base class From Form To User Control I think this is agood idea since "UserControl also has the same inheritance tree" but I don't know if i will face probems? but i will try
Thanks.
|
|
|
|
|
Try changing the .TopLevel property (it's hidden so it won't show up in Intellisense!) of your child forms to False, the you can set it's .Parent property to any object that derives from the Control class, like a TabPage.
Dim myForm As New Form3
myForm.TopLevel = False
myForm.Parent = TabPage1
myForm.Show()
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
sallam
i whant to make a c code(function)
which change the pc to aderess its mean we do any work that is perform on aderess via i print any thing
i whant that print on aderress screen
|
|
|
|
|
Your post didn't make ANY sense what-so-ever. We have no idea what you're talking about or what you want to do.
Perhaps someone who understands English better could post your question for you?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is it possible to implement BorderLayout,Flowlayout and Gridlayout using C#
|
|
|
|
|
|
This is the INSERT command i call to try and insert a new record into the MS SQL Table. There is another value "t_id" used for the ID, but it is set to auto increment in the database.
When i run this code i get this error:
Line 1: Incorrect syntax near '?'. <br />
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br />
<br />
Exception Details: System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '?'.<br />
<br />
Source Error: <br />
<br />
<br />
Line 178: <br />
Line 179: insCon.Open();<br />
Line 180: insCmd.ExecuteNonQuery();<br />
Line 181: insCon.Close();<br />
Line 182: <br />
public void AddTicket_Click(Object Src, EventArgs E){ <br />
<br />
string insSql = "INSERT INTO MCI_Tickets (t_date, t_num, t_circuitID, t_ter, t_sc, t_cu, t_loc, t_info) Values (?, ?, ?, ?, ?, ?, ?, ?)";<br />
SqlConnection insCon = new SqlConnection(Conn);<br />
SqlCommand insCmd = new SqlCommand(insSql, insCon);<br />
<br />
insCmd.Parameters.Add(new SqlParameter("@t_date", SqlDbType.DateTime, 8));<br />
insCmd.Parameters["@t_date"].Value = tDate.Text;<br />
insCmd.Parameters.Add(new SqlParameter("@t_num", SqlDbType.Char, 5));<br />
insCmd.Parameters["@t_num"].Value = tNum.Text;<br />
insCmd.Parameters.Add(new SqlParameter("@t_circuitID", SqlDbType.Char, 15));<br />
insCmd.Parameters["@t_circuitID"].Value = tCir.Text;<br />
insCmd.Parameters.Add(new SqlParameter("@t_ter", SqlDbType.Char, 5));<br />
insCmd.Parameters["@t_ter"].Value = tTer.SelectedValue;<br />
insCmd.Parameters.Add(new SqlParameter("@t_sc", SqlDbType.Char, 6));<br />
insCmd.Parameters["@t_sc"].Value = tSc.SelectedValue;<br />
insCmd.Parameters.Add(new SqlParameter("@t_cu", SqlDbType.Char, 6));<br />
insCmd.Parameters["@t_cu"].Value = tCu.SelectedValue;<br />
insCmd.Parameters.Add(new SqlParameter("@t_loc", SqlDbType.NVarChar, 50));<br />
insCmd.Parameters["@t_loc"].Value = tLoc.SelectedValue;<br />
insCmd.Parameters.Add(new SqlParameter("@t_info", SqlDbType.NVarChar, 50));<br />
insCmd.Parameters["@t_info"].Value = tInfo.Text;<br />
<br />
insCon.Open();<br />
insCmd.ExecuteNonQuery();<br />
insCon.Close();<br />
<br />
DoConnect();<br />
pnlAdd.Visible = false;<br />
}
Thanks, Any help would be appreciated
|
|
|
|
|
Hello gurus,
I'd like to know how I can add a scroll bar in a UserControl ?
The generated graphic is too big to fit to the size of the control, so I wish to scroll the content of the control.
Thanks for giving me a code snipet to solve this.
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
|
i have this code:
string a, b="test";
a=b.charAt(2);
but when i try to compile, i get this error:
'string' does not contain a defination for 'charAt'(CS0117)
what seems to be the problem?
|
|
|
|
|
The problem is that there is no charAt method on the string object (I think it's JavaScript having that method).
char a;
string b = "test";
a = b[2];
Should do the trick.
|
|
|
|
|
now i've this
string repRec,repAddr;
repRec=rec.ToString();
this.repAddr=repRec[2];
the compilation returns me an error of:
Cannot implicitly convert type 'char' to 'string'(CS0029)
|
|
|
|
|
You need to have a look at the basic types of C#. A char is a single character and it simply isn't the same type as a string. If you look at my sample code you would se that I was declaring a char - so not a string - to receive the value.
So this should work:
string repRec;<br />
char repAddr;<br />
<br />
repRec=rec.ToString();<br />
this.repAddr=repRec[2];
Notice that rec.ToString() is a bit scary - it is not strongly typed. I would recommend a real cast of possible (or access to string members - whatever), then you get an error if it does not make sense. You might be used to loose type checks from JavaScript and find the strict checks of C# annoying... just wait until you are used to them, then you will hate the loose typechecks as they give way too many errors.
|
|
|
|
|
It might help to read and understand the error message the compiler gives you - usually it's right.
With the error message and error number given it's really easy to find the error and its description on MSDN, for example, so you can understand what went wrong.
That's something you'll have to learn because it's a lot easier and faster than asking why a trivial error occurred on CP...
Regards,
mav
|
|
|
|
|
Hello, i use theese few lines of codes to open different windows, form different places, but it seems not so object oriented, could somebody tell me a nicer way to do it, that would be easier to maintain also?
public void openWindow(System.Windows.Forms.Form parentForm, String childForm, String layout)
{
switch (childForm)
{
case "frmAsiakkaat":
frmPink pink = new frmPink();
pink.MdiParent = parentForm;
pink.Show();
break;
case "frmKohteet":
frmGold gold = new frmGold();
gold.MdiParent = parentForm;
gold.Show();
break;
case "frmRaportit":
frmBlue blue = new frmBlue();
blue.MdiParent = parentForm;
blue.Show();
break;
case "frmTervetuloa":
frmGreen green = new frmGreen();
green.MdiParent = parentForm;
green.Show();
break;
}
}
R
John
|
|
|
|
|
|
Thx, that took care of a few lines of worthless code!
|
|
|
|
|