|
Yes, well I'm not build the columns in the designer. I'm building them in code.
|
|
|
|
|
The designer writes code, and I showed the working generated code... So it should work too if you type this manually if you prefer that.
Wout
|
|
|
|
|
Hello ...
I would like to create a sample messagbox which suppoted the
visual style office 2003.
I create a UserControl which inherits from
system.Windows.Forms.MessageBox (override paint method) ...
unfortunly I can`t intherits from messagebox!
Please tell me what I have to done to get a MessagBox which
supports the Office 2003 style.
best regards....
|
|
|
|
|
Just create a form which inherits from user control, slap your a label, image, and buttons on there and you're good to go. A MessageBox is just a type of form, after all.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
What's the proper way of overriding Dispose(bool disposing); in a UI control? The method is already overridden in the designer generated file in .NET 2.0. I never edit that file manually, so how are you supposed to override it then? Or is the proper way to add stuff to the components field, which gets cleaned up by the Dispose method? Then I have to make the disposable objects IComponent objects, slightly more work then I'd like to do.
Wout
|
|
|
|
|
// an example of the IDispose pattern
private System.ComponentModel.IContainer components = null;
public void Dispose()
{
this.Dispose(true);
}
protected internal void Dispose(bool disposing)
{
if ( disposing && components != null )
components.Dispose();
base.Dispose(disposing);
}
|
|
|
|
|
Yes yes, I'm not a moron. I'm wondering how I'm supposed to override the ALREADY OVERRIDDEN Dispose method present in the designer generated file, without touching that file.
Sorry, I'm not angry.
Wout
|
|
|
|
|
Quote: What's the proper way of overriding Dispose(bool disposing); in a UI control? :EndQuote
I answered what you asked.
If the Dispose method is already overriden and not made virtual, then you cannot override it.
|
|
|
|
|
You overlooked the "overriding" part?
My first feeling is too that I can't override without touching the designer file. That would be utterly stupid, and I can't believe that. So there must be a way of hooking into the Dispose... Maybe I should add the disposable part to the components field, at least that works.
Wout
|
|
|
|
|
Hi guys,
I am a newbie in C# and I need some help. If I open a database connection in my try statement, can I close it in finally. i.e. is finally always executed?
This is what I have; is this a good programming technique?
Please help
public int validateGLAccount(string Number)
{
//bool rt=true;
SqlConnection cnn=null;
SqlCommand cmd=null;
try
{
cnn=new SqlConnection(m_Cnn);
cnn.Open();
if (true)
{
cmd= new SqlCommand("SELECT count(ID) FROM table",cnn);
one = (int)cmd.ExecuteScalar();
if (one==1)
{
return -1;
}
else
{
return 1;
}
}
else
{
return -1;
}
}
catch(Exception ex)
{
MessageBox.Show(this,ex.Message);
}
finally
{
cmd=null;
if(cnn!=null && cnn.State !=ConnectionState.Closed)
{
cnn.Close();
}
cnn=null;
}
return -1;
}
sasa
|
|
|
|
|
Looks great. Even easier is doing:
using (SqlConnection connection = new SqlConnection(m_ConnectionString)) {
}
This is just some c# convenience for try {} finally { connection.Dispose(); }
Wout
|
|
|
|
|
Thank you for your response. I appreciate it.
sasa
|
|
|
|
|
SASA_1 wrote: I am a newbie in C# and I need some help. If I open a database connection in my try statement, can I close it in finally. i.e. is finally always executed?
Yes - the code in finally is always executed.
I'm new myself so won't comment on the code - if it works then it's fine Worry about perfection in a few months time!
Glen Harvy
|
|
|
|
|
Hi,
i need to translate a c# webcontrol in asp code.
For example:
Button b = new Button();
to
<asp:button id="Button1" runat="server" Text="Button"></asp:button>
I would pre-generate aspx page that can be modified in Visual Studio 2005.
Thank You
BDN
|
|
|
|
|
The combo box is usually used to select a value from a predefined list to insert into another object. So, in general we bind the ComboBox to the list of values and get the SelectedValue for updating.
My question is this: is there a simple way for the ComboBox to updates its own values when a user types values?
My ComboBox is bound to a three column data table and in my wildest dreams I'd like for the user to type a value and the datatable updates the value previiously selected instead of moving the SelectedIndex to -1.
I didn't find any example of this anywhere.
Thanks in advance.
|
|
|
|
|
Are you working in WinForms or ASP.NET? It makes a world of difference.
|
|
|
|
|
Sorry, important detail, I work in WinForms
|
|
|
|
|
The program I’m working on allows the user to produce a number of pictureboxes, set their pictures and drag them around. I also needed to store extra information about each picturebox, so I created a class called ‘item’ that has values such as ‘previousx’ ‘previousy’ etc. At the moment I have an ‘item’ for each picturebox, and all the ‘items’ in a collection so that when the user starts working with a different picturebox, the program has to look through the collection to find the correct item, so it can display the correct variables.
However, I realised that the Tag property of each picturebox can take an object, not just a single string or int etc. So attaching each picturebox’s item class to its tag should be more efficient and easier to work with. My problem is, how do I go about accessing the variables once they are stored in the tag. For example,
x = pictureBox1.Tag.previousx
would give an error on compile, as the property does not exist at build time. Is there any way to get this to work?
Thanks for the help.
|
|
|
|
|
Here is an example : the ... represents a jump in your code to the appropriate location.
ValueItem item = new ValueItem();
...
pictureBox1.Tag = item;
...
ValueItem item = (ValueItem) pictureBoxn.Tag;
this.descriptor.Text = item.Description;
|
|
|
|
|
Hello,
I am using Membership's encrypt/decrypt methods. When I encrypt the string, it increases the length of the string. Is there any way I can set the lenght of encrypted string?
OR is there any way to know how much length will increase after encryption. based on that I need to set length of column in database.
Thanks in advance.
- ashish
|
|
|
|
|
hi
i want to print my form .. how to do ??
and how to print multiple page (for example a datagrid with many record or a form with many controls) ??
thanks ..
bye ..
|
|
|
|
|
|
yes .. i know . but how to use these classes and objects ??
|
|
|
|
|
Can you tell me how to give power to transistor or somethiog else?
|
|
|
|
|
What exactly does this have to do with C#
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|