|
As seems to always be the way - as soon as I ask for help I find the answer.
If I use "BindingFlags.PutDispProperty" instead of "BindingFlags.SetProperty" it works.
Any idea what the difference between them is? I cannot figure it out from the MSDN...
|
|
|
|
|
Andrew_Thomas wrote: Any idea what the difference between them is?
Not really sure, sounds like COM stuff
|
|
|
|
|
I have a C# application I am working on which contains a TabControl with several TabPages. Before I continue with implementation, I have thought it best to create individual classes for each TabPage. I think this is a better design than having one big form with loads of code.
I am wondering if I can use the Designer to design each TabPage. It seems only a class derived solely from Form can use the Designer. For my TabPage, I can drag items from the Toolbox into the Designer, but I have no window/dialog control to place them in, so there is no way to place an item in a particular location within a window. I need to specifically set the locations in code.
Is there some easier way to do this?
Thanks again for the help.
Note, I am using C# Express.
|
|
|
|
|
Actually you can use the designer for anything derived from Control, Forms and custom controls included. Try creating custom controls for each page, and set the tab page's content to that control.
|
|
|
|
|
Thanks. That is very helpful and should get me going on to the next step.
|
|
|
|
|
Im doing this project, in Visual C#
and ive run into a small problem.
I have the main form (wich will start when the program is executed)
Now on that form i have a button and if i press this button the first form Hides and a second form shows.. now what i need the second form to do is to show on exactly the same spot that the previous form did (to give the illusion that the form just changed apperance)
Is that possible ??? and if so, how do i do that???
Or is it just more simple to use MDI forms??? with Childs and such.. one thing that anoy's me with MDI forms is that if i use the code to maximize the Child form it will show a control button in the upper left corner wich i do not want it to do..
the code i used to get it maximized is rather simple its
newFrm.WindowState = System.Windows.Forms.FormWindowState.Maximized;
Brothers what we do in life, echoes in eternity!!!
|
|
|
|
|
Point firstFormLocation = firstForm.Location;
Size firstFormSize = firstForm.Size;
firstForm.Hide();
secondForm.StartPosition = FormStartPosition.Manual;
secondForm.Location = firstFormLocation;
secondForm.Size = firstFormSize;
secondForm.Show();
I don't recommend this at all though... it'd be much better to use container controls in one form and just swap those.
-- modified at 15:53 Tuesday 30th May, 2006
p.s. I like how people vote down posts without even giving their own input... not being helpful to anyone. Nothing but rude.
|
|
|
|
|
If treelist have open node, and i add new node to treelist - new node not can have focus.
treelist.AllNodesCount = all nodes in treelist - 1 ???
But if all node is close, and i add new node - !!! my new node can have focus!!!
treelist.AllNodesCount = all nodes in treelist !
My code:
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Nodes;
namespace video
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
TLNode tln1 = new TLNode(1, treeList1.Nodes, "dfhdfhgdf", "234523");
treeList1.Nodes.Add(tln1);
treeList1.FocusedNode = tln1;
}
private void simpleButton2_Click(object sender, EventArgs e)
{
TLNode tln1 = new TLNode(1, treeList1.Nodes, "4567rtyu4567", "ertye3456ertye");
tln1.HasChildren = true;
TLNode tln_children = new TLNode(2, tln1.Nodes, "trtr3636yryr", "6868cncn2525");
tln1.Nodes.Add(tln_children);
treeList1.Nodes.Add(tln1);
}
}
public class TLNode: TreeListNode
{
string name;
string url;
public TLNode(int id, TreeListNodes owner, string name_, string url_) : base(id, owner)
{
name = name_;
url = url_;
}
public override void SetValue(object columnID, object val)
{
}
public override object GetValue(object columnID)
{
return "text";
}
}
}
How to do this problem?
Help me please.
|
|
|
|
|
Dima Filipiuk wrote: using DevExpress.XtraTreeList
You should be asking the DevExpress ppl, first at least...
|
|
|
|
|
Format : INSERT INTO Tablename(Var1,Var2,...) VALUES(Value1,Value2,...)
If there is one variable (Var1 as Date/Time variable),what is the format of Value1(#5/29/2006#,"5/9/2006",#29/5/2006#,"29/5/2006"). I've tested all of Value1's format.But it's still Systax Error.
Thanks
Surasak
|
|
|
|
|
Hi, Surasaku.
I'm not sure why you're having a problem with the syntax. I just got through with some stuff using the "#5/30/2006#" format in the sql strings. Could it be that the syntax error is caused by something other than your date field?
Author of
The Career Programmer and Unite the Tribes
Know someone who desperately needs to get a clue?
Visit www.DownloadAClue.com and send them one!
|
|
|
|
|
What database are you using?
Access uses # around a date, MS SQL and MySQL uses apostrophes (').
Try using ISO 8601 format: 2006-05-29
---
b { font-weight: normal; }
|
|
|
|
|
surasaku wrote: Hi Guffa,
Thanks for reply my message. I use Access database.Could you please see my code below? After debugging,the error message is "Syntax error in INSERT INTO Statement". Where is it wrong?
[Code]
string sql2;
string ContentUpdate = textBox2.Text;
DataView dv4 = new DataView(Dset.Tables["myData"]);
dv4.RowFilter = "Date =#"+dateselect+"#";
if (dv4.Count!=0)
sql2 = "UPDATE Content SET Content = '"+ContentUpdate+"' " +
"WHERE Date = #"+dateselect+"#";
else
sql2 = "INSERT INTO Content(Date) VALUES(#2006-05-30#)";
OleDbCommand cmd = new OleDbCommand();
OleDbTransaction trans;
try
{
conn.Open();
trans = conn.BeginTransaction();
cmd.Connection = conn;
cmd.CommandText = sql2;
cmd.Transaction = trans;
cmd.ExecuteNonQuery();
if(MessageBox.Show("Are you sure to Save data?","Data
Saving",MessageBoxButtons.OKCancel) == DialogResult.OK)
trans.Commit();
else
trans.Rollback();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
conn.Close();
}
Date is a reserved keyword. Change the field name, or if that is not possible, use brackets [] around the field name in the query.
---
b { font-weight: normal; }
|
|
|
|
|
Hello!
I have this code:
GraphicsPath path1 = new GraphicsPath();
path1.AddEllipse(10,10,100,100);
PathGradientBrush brush1 = new PathGradientBrush(path1);
brush1.CenterColor = Color.White;
Color[] colorArray2 = new Color[] { ScaleColor(Color.White, 0.25f) };
Color[] colorArray1 = colorArray2;
brush1.SurroundColors = colorArray1;
-----------------------------------------------------------------------------------
public static Color ScaleColor(Color sourceColor, float scale)
{
int num1 = (int)(sourceColor.R * scale);
int num2 = (int)(sourceColor.G * scale);
int num3 = (int)(sourceColor.B * scale);
if (num1 > 0xff)
{
num1 = 0xff;
}
if (num2 > 0xff)
{
num2 = 0xff;
}
if (num3 > 0xff)
{
num3 = 0xff;
}
return Color.FromArgb(num1, num2, num3);
}
---------------------------------------------------------------------------------------
this works fine but when i change the size of the ellipse and the width or height is zero my project shows an exception : Out of memory
Somebody knows why this happen or why can i do to fix this?
Regards,
Alberto Martinez
|
|
|
|
|
hi everyone!
i'm making an application and i want to use in it an error reporting system.
i want to make the program sent an email (with enclosure) without open the email browser.
just send it...
i want to specify the enclosure (e.g. the path of a picture).
can someone help me?
Thanks in advance
Enrico
VentoEngine corp.
Program your life ^^
|
|
|
|
|
For framework 1.1: System.Web.Mail namespace.
For framework 2.0: System.Net.Mail namespace.
---
b { font-weight: normal; }
|
|
|
|
|
can you give me more information?
VentoEngine corp.
Program your life ^^
|
|
|
|
|
Ventomito,
Here's a routine I keep around for such things. You'll naturally need to insert the name of your smtp server in the slot indicated. Hope this helps.
using System.Web.Mail;<br />
<br />
protected Boolean SendEmail(string strFromEmail, string strToEmail, string strSubject, string strBody)<br />
{<br />
Boolean bStat = false;<br />
try<br />
{<br />
MailMessage Message = new MailMessage();<br />
Message.To = strToEmail;<br />
Message.From = strFromEmail;<br />
Message.Subject = strSubject;<br />
Message.Body = strBody;<br />
<br />
SmtpMail.SmtpServer = "your.smtpserver.com";<br />
SmtpMail.Send(Message); <br />
bStat = true;<br />
}<br />
catch (Exception)<br />
{<br />
bStat = false;<br />
}<br />
return (bStat);<br />
}
Author of
The Career Programmer and Unite the Tribes
Know someone who desperately needs to get a clue?
Visit www.DownloadAClue.com and send them one!
|
|
|
|
|
I have a user control with labels on it.
But I need to get the click event. And since the backgroup is transparent I cant get a click.
Is there a hit test event i can do or something.
I tried MouseClcik and Click and it doesn't work
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I vaguely remember it being possible to compare regions in GDI, and determine if they overlapped. Then use this value in a collision detection algorithm.
Is there a simple way to compare regions without using a graphics object? Or do i need to make bounding box maps and compare them?
Cheers
Tris
Update: I have regions which define the shape of objects. And depending on the entity that it represents, it will have a translation Matrix applied to it. I need a way to test whether two regions, with the relevant Matrix applied, overlap in any way.
This seems like a pretty fundamental requirement that should be doable without any kind of farting around with graphics handles etc.
|
|
|
|
|
i want to attach a database to sql server using C#?
my ordinary way to do this is to run this statments in Query Analyzer:
EXEC sp_detach_db @dbname = 'test'
EXEC sp_attach_single_file_db @dbname = 'test',
@physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\test_data.mdf'
but now i want to do this using c#!!!
thanx
|
|
|
|
|
Use a SqlCommand and ExecuteNonQuery()
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi,
I have a Image object on the memory, now I want to convert this object to byte[] without saving it to harddisk!
How can I do this?
Thanks,
Hung
|
|
|
|
|
<br />
byte[] image_bytes = null;<br />
using (MemoryStream ms = new MemoryStream())<br />
{<br />
image.Save(ms, ImageFormat);<br />
image_bytes = ms.ToArray();<br />
} <br />
The Quran's Rational Arguments (Audio)
Background on Prophet Muhammad (in progress)
"They are MUSLIM. It does not matter how you split it up: all msulims (so they say) see every other muslim as a brother, regardless of origin or nationality." -legalAlien. Alhamdullah for the blessing of Islam
|
|
|
|
|
When i select any control(say button), the PropertyGrid does not does not display the "Name" property. How do i make this property available so that user can edit the "Name" property at runtime?
Note - Using System.ComponentModel and System.ComponentMOdel.Design namespaces
Navin
-- modified at 11:28 Monday 29th May, 2006
|
|
|
|