|
Nothing really, the most important thing with structs is they're value types, i.e. if you did the following:
aStruct firstStruct = new aStruct();
firstStruct.sId = 5;
aStruct secondStruct = firstStruct; then secondStruct contains a copy of firstStruct not a reference to it, i.e. you can change properties on secondStruct without changing firstStruct . If this were a class then changing secondStruct would change firstStruct as well.
To be honest I would use the second method because it is more explicit and clearer what you are trying to do, if you then decide to change the declaration of aStruct to a class rather than a struct then you don't have lots of NullReferenceException s popping up all over the code.
|
|
|
|
|
Thx alot, so say for example if i wrote the following:
public struct aStruct
{
public int sId;
};
static void Main(string[] args)
{
Program prog = new Program();
aStruct theStruct;
ArrayList list = new ArrayList();
theStruct.sId = 5;
list.Add(theStruct);
theStruct.sId = 6;
list.Add(theStruct);
theStruct.sId = 7;
list.Add(theStruct);
}
I would then add three objects of type theStruct to the list even though I didn't explicitly created them with new?
|
|
|
|
|
|
|
While Ed has given you the correct answer here, you should really try this out for yourself rather than relying on others. This is down to the fact that sometimes people give answers without really knowing what they are talking about. (Note - Ed is one of the ones who DOES know what he is talking about).
Never accept that you have been given the correct answer. Try it out, and make sure that it is the correct answer.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: Note - Ed is one of the ones who DOES know what he is talking about
Well that's nice to know
|
|
|
|
|
Well, credit where credit is due.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
But now you have to live up to your reputation.
|
|
|
|
|
Damn!
|
|
|
|
|
i wanted to know something about
inproc(InProcess)
StateServer (outProcess),
SQLServer (database based)
What knowledge does these terms hold for the session state.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Googling turned this[^] up. I would suggest that you try google as a starting point.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
one clarification i wanted to make is that , when the user visit the web site in the web browser , after proving the authentication , the session values gets stored in web server or in the web bowser.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Session never gets stored on the browser. How could it?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
ok
Soniagupta1@yahoo.co.in
|
|
|
|
|
In my PropertyGrid I have a combobox with a large amount of items. For filtering purposes I am trying to implement a combobox WITHIN the PropertyGrid that has an internet explorer address comboxbox behaviour, that is, as the user types into the combobox, the dropdown part is opening and the items are filtered alphabetically (according to the typed letters). For example, the user types "go" into the combobox field and the unterlying list items are limited to items that start with "go".
I tried 2 ways already: 1) derive from UITypeEditor and 2) implement a TypeConverter with StandardValuesSupported. In both ways I can nicely display the combobox but I did not find a way to extract the combobox control and to access it in any way. Any suggestions?
-- modified at 12:05 Monday 10th September, 2007
|
|
|
|
|
Hi,
why do you need to access the dropdown box if your TypeConverter is able to supply the right strings to be displayed...
|
|
|
|
|
So, how would you implement my requested feature using the TypeConverter?
|
|
|
|
|
well, if you answer a question by another question, it will be difficult to help. The reason I intervened is because I implemented such a feature in Smart PropertyGrid. But the framework is really different from the MS PropertyGrid so it may be difficult to implement it. Since you said you were successful in 1. the UITypeEditor and 2. the TypeConverter, I was unable to see why you needed access to the dropdown part of the combo... Also how did you do to intercept the keys typed in the textbox to restrict the possible values of the converter ? Did you succeed ? If I know where and why you feel stuck, I may be able to help...
|
|
|
|
|
Sorry, my first comment might have been misleading. I was NOT successful in implementing a combobox which drops down on typing keys into it (like the IE url-address text field). I implemented a regular combobox where the user is able to select an item from the list, but he is not able to type his own string. However, I can intercept the keys in the textbox by something like this:
<code>
private TextBox m_Textbox;
foreach (Control control in _propertyGrid.ActiveControl.Controls)
{
if (control.GetType().ToString() == "System.Windows.Forms.PropertyGridInternal.PropertyGridView+GridViewEdit")
{
if (control is TextBox)
{
m_TextBox = control as TextBox;
break;
}
}
}
</code>
This is how I access the text box in the PropertyGrid. Then I can attach the TextChanged event to the textbox and intercept the keys typed in. Now - as the user types his keys - I want the combobox to drop down and automatically restrict the values. Does this make sense to you?
|
|
|
|
|
OK, I see now, except that I'm not sure if you implemented your own UITypeEditor or not. Anyway, using your own one or the default one, you won't be able to show the dropdown box and at the same time to have the focus in the textbox to let the user continue typing. This is even the same in Smart PropertyGrid. So how did I implement it in SPG ? I used the autocompletetion feature of the textbox. It looks something like that in my code:
string[] displayedValues = propEnum.Property.Value.GetDisplayedValues();
if (displayedValues.Length > 0)
{
System.Windows.Forms.AutoCompleteStringCollection coll = new System.Windows.Forms.AutoCompleteStringCollection();
coll.AddRange(displayedValues);
tb.AutoCompleteCustomSource = coll;
tb.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
tb.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
}
tb is the textbox, so since you have a hack to get access to your textbox, you could maybe do the same. I can assure you that this a waste of time to try to do it with the UITypeEditor in the MS PropertyGrid.
|
|
|
|
|
Oh dear, I think I have a lot of troubles dealing with common controls today..
tabControl1.SelectedTab.Font = new Font("Tahoma", (float)8.25, FontStyle.Bold);
The above line is simply not working! May I know how do you manage to do it?? "Changing the currently selected tabpage font"
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello Muammar,
The Font of the Text you see in the Tab Selection is not a member of the TabPage itselve.
It is a member of the TabControl.
So if you set the Font property of the TabControl, all the TabPage writers will change.
If you whant to chenge only one (the active one), you better inherit you own TabControl and:
1)Set "this.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;" in the Constructor
2)override OnDrawItem:
protected override void OnDrawItem(DrawItemEventArgs e)
3)set a Font variable accordingly to EventArgs index:
Font actFont;
if(e.Index != this.SelectedIndex)
{
actFont = e.Font;
}
else
{
actFont = new Font("Tahoma", (float)8.25, FontStyle.Bold);
}
4)write the Text (using System.Drawing)
using(StringFormat sf = new StringFormat())
{
sf.Alignment = StringAlignment.Center;
e.Graphics.DrawString(this.TabPages[e.Index].Text, actFont, Brushes.Black, e.Bounds, sf);
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
Thanks Martin
That was a great help indeed!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
You are wellcome!
Glad I could help!
All the best,
Martin
|
|
|
|
|
Hello
I want to reload the new data from the dataset into the DataGridView
how i can do ?
This my code:
adap.SelectCommand = cmd;
ds.Tables.Remove("CreditCardInfo");
adap.Fill(ds, "CreditCardInfo");
dtgCreditInfo.DataSource = ds;
dtgCreditInfo.DataMember = "CreditCardInfo";
txtNewCustName.Text = dtgCreditInfo.Rows[0].Cells["CreditCardOwner"].Value.ToString();
dtgCreditInfo.Update();
this not work, can someone tell me what i should do ?
Assaf
|
|
|
|