|
Thanks Draco,
Not sure how I missed that one.
I added this to the click event:
listView1.FocusedItem.Text
|
|
|
|
|
albean wrote:
Not sure how I missed that one.
Because it's not really a standard thing in the framework. Usually it's SelectedIndex or SelectedItem. You could also use the SelectedIndices property...and then the first selected index would be listView1.SelectedIndices[0].
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
How can I write a Datatable to and XML file.
|
|
|
|
|
check out the intellisense its in black and white. Good luck with school
|
|
|
|
|
Hey all,
I'm wondering how I can get the version and build info from AssemblyInfo.cs to display in my program. I'm making an "About Box" and I'd like to be able to display this info on a label in the box. Can anyone help me out?
|
|
|
|
|
Application.ProductVersion
|
|
|
|
|
Is there a way to make it just show the major/minor version? Or only the build number?
|
|
|
|
|
Version ver = new Version(Application.ProductVersion);
string s = String.Format("v. {0:#}.{1:#}.{2:#}.{3:#}", ver.Major, ver.Minor, ver.Build, ver.Revision);
Check out the Version class in Help for more info.
|
|
|
|
|
I have CodeObjectList class in which I implmeneted IBindingList, ITypedList, IComponent, IListSource
When I do this
(ComboBox named cboCode)
(cList is the above class)
cboCode.DataSource = cList;
cboCode.DisplayMember = "Description";
it works fine
but
cboCode.DataBindings.Add("Text", cList, "Description");
the it just shows the first item as text and no drop down menu selections.
How come, how do I modify it to use the data bindings collection?
thanks
nick
|
|
|
|
|
is it possible to compile with VS. NET for the .NET 1.1 and with VS 2003 for .NET 1.0?
if it is possible, how can I use .NET 1.1 with VS.NET? or the upgrade is obligatory
|
|
|
|
|
Zibar wrote:
is it possible to compile with VS. NET for the .NET 1.1 and with VS 2003 for .NET 1.0?
No
Mazy
No sig. available now.
|
|
|
|
|
this is stupid... pushing technology forward is good but forcing people to do it is not.
|
|
|
|
|
Everyone,
I need some advice for a validating a textbox. I need to make sure the textbox is not empty with a custom validation form object. The custom validation is a requirement because I dont want to check the text box if it is not visible. Thanks in advance.
Courtney
|
|
|
|
|
Well, you could derive your own textbox and override the OnValidating method to perform validation...or you could have a normal textbox and subscribe to it's Validating event and perform validation that way.
Basically you have:
Way 1)
public class ValidTexbox : TextBox
{
protected override void OnValidating(CancelEventArgs e)
{
base.OnValidating (e);
if(this.Visible == true && this.Text.Length == 0)
{
e.Cancel = true;
MessageBox.Show("Input invalid");
}
}
}
Or
Way 2)
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
this.textBox1.Location = new System.Drawing.Point(8, 16);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 0;
this.textBox1.Text = "textBox1";
this.textBox1.Validating += new System.ComponentModel.CancelEventHandlerthis.textBox1_Validating);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
private void textBox1_Validating(object sender, System.ComponentModel.CancelEventArgs e)
{
if(textBox1.Visible == true && textBox1.Text.Length == 0)
{
MessageBox.Show("Input invalid");
}
}
}
Either way, you have to have the CausesValidation property of the textbox set to true. Then it'll work just fine.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
hello!
I have a problem with the forms designer of VSNet 2003. I created a
user control that loads some pictures located in the working directory
(in my case, it's something like C:\myproj\sources\exe) - I'm using
the Directory.GetCurrentDirectory to get the full pathname. The
control constructor calls a method that loads the pictures and I
override the Paint method, it renders the pictures.
Now, if I add my control in the main form, the designer complains
about the files path : an exception is launched, it says the files
could not be found in C:\myproj\sources. I'd like to know :
- how to force the designer to look for files IN the working directory
or any directory. I looked around in VSnet but couldn't find any
dialog box with such parameters. The designer just doesn't want to
know about the working directory.
- if this solution is not possible, how to avoid the "execution" of
the control in the designer (ie. just a frame with the background
color, not all pictures, that's it...no call to the Paint method)
Thanks if you can point me to some tricks about that.
|
|
|
|
|
nobody had this problem ?
|
|
|
|
|
Using the form's Focused property.
For instance
if(this.Focused==true)
{
}
|
|
|
|
|
Have you tried using the Activated and Deactivate events along with a boolean variable.
|
|
|
|
|
But the definition for a top-most window is a form that overlaps all the other forms even if it is not the active one.
What do you want: The active window or the top-most window?
Inside C# you have the topmost property. Otherwise you can use WIN32 API
|
|
|
|
|
apferreira wrote:
Inside C# you have the topmost property.
The topmost window makes the window be always-on-top, and is equivalent to:
SetWindowPos(this.Handle, HWND_TOPMOST,0,0,0,0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
It does NOT tell you whether your form is top in the ZOrder.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Use the GetWindow() API:
bool IsTopWindow=(GetWindow((IntPtr)0,GW_HWNDFIRST)==this.Handle);
The API is declared like this:
[DllImport("user32.dll")]
private static extern IntPtr GetWindow(IntPtr hwnd,
int flags);
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
You're welcome.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Hi everyone. Well, I was looking for something to do tonight, and thought why not see what to do with exchange. By this I mean, we use Exchange 2000 at work, and it works. But it is very slow, and has loads of extra functions that a lot of people would not use. So I wanted to see if I could make my own.
Anyway, the problem is this. Where do you get started trying to make an app that uses Exchange? I could not find much on MSDN, it seems to all be about Exchange 2003. If you have any ideas, or know a good tutorial, please let me know.
|
|
|
|
|
|
Ok. I've been learning C# and I'm starting an aplication that uses a Listview in Detail view. I want to make the columns re-orderable and be able to save the order for the next time the form is loaded. But I dont know how to get the column order. The indexes dont change, so the columns are not rearanged in the collection.
Can anyone help? Thanks!
Scott Kelly
|
|
|
|