|
I have the vaguest recollection of being able to send a message to a control in the past where I got this error message for trying to set opacity, but I just can't remember the details. I hope it works out for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can I possibly use panel and write
this.tabControl1.Width=this.ClientSize.Width/3;
something like that..let me try and see
|
|
|
|
|
Yes, you can do that in your OnSize, for sure. That's the sort of thing I had in mind when I said to use OnSize.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
lil more on onSize method may help me, Chris..I am not sure how I want to do that.
|
|
|
|
|
Your form has an onsize event. It is fired when the form is resized. If you set up your code as you said to resize stuff in that event, then when the form is resized, the controls will be sized by your code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Worked...Worked...Worked.. ...Actually, that is the Resize method. Thanks..Gotta work for the opacity of the shellcontrol..Regards..Amit
|
|
|
|
|
Unless you want to make this collection public, so that anyone can use it in any way, I'd suggest adding methods for the bits you want to expose, for example, adding an ObjectCount property to Room that returns RoomObjects.Count would make more sense. Then an Add method that adds an object to the room, etc.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
VickyC# wrote:
Practically the RoomObjects is public. But does not appear.
It can't be practically public, either your instance of the class is public, or it isn't.
VickyC# wrote:
public class Room {
protected string _name;
public Room() { }
public string Name {
get {return _name; }
set {_name = value; }
}
public class RoomObjects : System.Collections.CollectionBase {
public void RoomObjects{}
public void Add(RoomObject roomObject) { List.Add(roomObject); }
.
.
.
public RoomObject Item(int Index) { return (RoomObject) List[Index]; }
}
}
and RoomObject is just another class.
This is a class within a class. Room.RoomObjects.xxx will only show static members, you'd need an *instance* of this class that is public to call non static methods like Add and Count. Does an instance of this class exist inside Room, or just the class itself ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I was just thinking about this, it's not a program or anything (or in one...)......
Given a DateTime, how can I find the a DateTime for the following Friday in that week?
/\ |_ E X E GG
|
|
|
|
|
Use the DayOfWeek property to work out how many days ahead you need to go.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Try this simple test:
Drop a NumericUpDown control (nud1) and a Button (b1) on a form. Make sure that nud1.DecimalPlaces is set to 0. In the Click handler of b1, display the value of nud1 by doing MessgeBox.Show(nud1.Value.ToString()). Run the application and type 4.513 in nud1 and click b1. The MessageBox will display 4.513 as the value, but nud1 will contain 5. Now click the up arrow of nud1 and then click b1. The MessageBox will now display 5.513 and nud1 will contain 6. If you type a new value, say 17, into nud1, the decimal places will go away. The same type of problem shows up if you set nud1.DecimalPlaces to 3 and type 7.12345 in nud1 (the extra decimal places hang around).
You can get around this by using the NumericUpDown.Text property (it always gives the correct value). However, studio does not show this property in the properties window and it does not appear when performing a ‘code complete’ when typing. The Text property is an overridden property of UpDownBase.
This appears to be a big problem since all of the msdn examples for NumericUpDown use the Value property to retrieve the value of a NumericUpDown. Does anyone have any comments/opinion?
Thanks …
wjr@itt
|
|
|
|
|
Looks to me like the value property gives you the number of decimal places you asked for, and the Text property does not. Why is this a problem ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Take another look. The Value property, which is what they want you to use according to the examples, does not give what was asked for. In any case, nothing should give you something different than what is shown in the control.
wjr@itt
|
|
|
|
|
What you're basically complaining about is that the text box does not enforce the decimal places property. If you want that, then you should build a class on this one. Otherwise, the Value enforces the decimal places property, even if the entered text does not match it. I still don't see the issue. If you want the decimal places enforced in the text box, create a class. If you don't want it to work like this, set the decimal places value to something other than 0.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian,
When you get the Value property from the NumericUpDown, it is suppose to give you the value that is displayed in the control. The whole purpose of the NumericUpDown is to make things easy for you so that you do not have to check what the user is typing. It will check the min and max, the number of decimal places, and the characters that are type if you choose hex. I know that I can write my own class. I wrote my own numeric up down 10 years ago in Motif and have been using ever since. It's not hard to do, but why duplicate what the supplied classes are SUPPOSE to do for you? Again, the purpose of the NumericUpDown is to automatically enforce the limits set by the properties and give you a value that you can count on as being correct. If it does not do what is advertised, it is a problem.
wjr@itt.com
|
|
|
|
|
wjr@itt.com wrote:
Again, the purpose of the NumericUpDown is to automatically enforce the limits set by the properties and give you a value that you can count on as being correct. If it does not do what is advertised, it is a problem.
But the problem in essence is that the text box does not enforce the number of decimal places you asked for, right ? The Value property does not have a problem, except that it enforces what the text box does not. To my way of thinking, the decimal places property is provided to give you a value within a fixed range that you've requested, but if a use goes outside that, it rounds it for you. If this is not what you want, then you can either have no decimal place specification ( which means you can use the value property ), or you can write your own control to enforce it in the text box as well ( which would mean you could use the value property ).
As far as I can see, it behaves as advertised. The Value property gives you the value in the text box, after applying the rules that you asked it to. I understand that it's not doing what you want, but the Value property is NOT the problem, it's working fine, and overall, it works as the docs suggest. The problem is in what you were hoping for, which is why it's possible to derive your own controls, to get behaviour the framework does not provide.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian,
Please read the example carefully. The text box ALWAYS displays the correct value (the correct number of decimal places). When you retrieve the value from the text box using the Value property, it DOES NOT return what is displayed and it has the wrong number of decimal places. THE VALUE PROPERTY DOES NOT RETURN THE VALUE IN THE TEXT BOX. I can't make it any simpler than that.
|
|
|
|
|
Oh... I see what you mean now. I have to admit, I read through what you were saying, and got it backwards. So the text box is masked, and so the Text property works, but the Value is not reset at the same time.
I'd agree then, this is a bug, and it's still present in VS2005. I'll bring it up in Seattle.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I discovered a problem with my workaround of using the Text property of the NumericUpDown to retrieve the correct value that is displayed by the control. In my simple example that I posted, accessing .Text worked fine. In my real, more complex app, accessing .Text in the button click handler caused the NumericUpDown to continue to display the wrong value (wrong number of decimal places) and the value returned by .Text was incorrect too. My workaround for this was to create a Validated handler for the NumericUpDown that did nothing more than assign the Value attribute to a variable and do nothing else with it. As long as .Value is accessed before anything else accesses .Text, things seem to be OK.
wjr@itt
|
|
|
|
|
I need to add and remove points to an image loaded from a file,
the procedure would be first select the add or remove button and
then select the position in the image where we want to add or
remove. I have to do this both in C# and ASP.net
If you could give me any hint or paste some code i would appreciate
it. thank you
|
|
|
|
|
Don't cross post.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a TabControl, and tabs can be dynamically added for users. When a tab is added, a user-control is added to that tab. So each tab has an identical user control, and each control is made up of a group of identical controls. I need to access those controls, in this case, a timer from the main window, but I cannot just use the name of the timer "refreshTimer". How would I access them?
I have tried
tabcontrolname.tabpages[selectedIndex].usercontrolname.refreshTimer.Start();
along with several other variations, but none of them have worked so far. Any suggestions?
|
|
|
|
|
Every time a new control is added, store it in a ArrayList then you can cast any object from the array list and access its properties.
|
|
|
|
|
Either I don't understand your solution or I didn't explain myself very well. It works like this.
on my form (MainWindow) I have a TabControl called MonitorTabs. I programmatically add a tab to it for each user I want to monitor like so:
<br />
TabTitle = FirstName + " " + LastName;<br />
TabPage newMonitorTab = new TabPage(TabTitle);<br />
MonitorTabs.TabPages.Add(newMonitorTab);
Then I add a user control called Monitor that contains a group of controls including a timer (RefreshTimer) to that tab like so:
Monitor monitor = new Monitor();<br />
monitor.Size = newMonitorTab.Size;<br />
monitor.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;<br />
monitor.UserID = UserID;<br />
newMonitorTab.Controls.Add(monitor);
Then the function ends and other things happen. From the menu in MainWindow, I call a function that needs to reset the interval on RefreshTimer on the currently selected tab. There may be three RefreshTimers, one on each User Control/Tab, and I don't know how to access any of them let alone the one that is currently selected. The timer is set to public, and still nothing shows up. I hope this explains it better. Thanks for any forthcoming help
|
|
|
|
|
i am loading a flash movie into a .net page and i want to send it the url of the application
the flash movie gets data from the same application, but we are not using web services...they dont want to do that yet
so as i develop, i could hardcode the url for the .aspx data file
but i would rather pass flash a value of the base url
like - http://localhost/report_application/sample + actual file name
how do i get that?
|
|
|
|