|
Henry Minute wrote: It is possible to parent controls in a Form.
by using win32 API yes I can.
But before I go for API solution, I try to see if this ability is available in vb native code.
Thanks in advance for any help.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
You do not need Windows API.
................
Dim form3 as New Form3;
form2.Controls.Add(form3)
As I said before a Form instance is really an instance of a Control, and can be treated just like a control, in most instances.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi
You should excuse me. The stupidity bill I take last long more than expected.
for 5 hours and before you post this, I was thinking that you are telling me that what I am asking for is not possible, since Dave also answer that it cannot be done in Mdi.
Just before 10 minute I got what you are asking me to do. You was guiding me to the solution, and I thought something else.
Henry Minute wrote: form2.Controls.Add(form3)
That is totally something new to me.
That did job perfectly.
Thank you very much.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
My pleasure.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Windows does not support having an MdiChild also be an MdiParent.
You're going to have to rethink your design.
|
|
|
|
|
Dave Kreskowiak wrote: Windows does not support having an MdiChild also be an MdiParent
Maybe, but I can do it in VFP, and I don't think vfp is better in vb.net 2008
if vb cannot do it, that is another matter.
Please see this picture below.
http://s701.photobucket.com/albums/ww15/Thecaptin72/?action=view¤t=multiforms.png[^]
TIA
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Samir Ibrahim wrote: Maybe, but I can do it in VFP,
VFP does not use MDI and VB.NET and the .NET Framework is not FoxPro.
Samir Ibrahim wrote: if vb cannot do it, that is another matter.
It's not VB that has the problem - it's Windows. I said you cannot use MDI to do what you want.
You CAN however set the TopLevel property of a Form to False and use the form as a control on another form. This is approximately the technique FoxPro uses. It's not true MDI, but it's the closest you're going to get.
|
|
|
|
|
Hi
I'm am using VBA functions in excel to calculate individual cell values. These work fine when the sheet wherein they are contained is active, but sometimes if I navigate to a different sheet and back again all I get is #VALUE in every cell. Interestingly this especially seems to happen when I open another spreadsheet (one on which Spreadsheet 1 depends for a number of values - none of which precede the cells giving the #VALUE errors though). What is probably most annoying is that it happens sometimes and sometimes not and I can't seem to identify why.
Here is a code snippet. This wasn't written by me, but it is relatively simple so I am slightly stumped here:
Public Function GLA(Cat As Integer, Age As Double, Sal As Double, run As Integer, chk As Double)
Application.Volatile
Dim Mult As Double
Dim Flat As Double
Dim MaxGLA As Double
Dim CeaseAge As Double
Dim startRow As Integer
Dim Column As Integer
Dim Retention As Double
exist = Sheets("Parm").Cells(21, 4).Value
If exist = 1 Then
Column = IIf(run = 0, 3, 9)
startRow = 32
Mult = Sheets("Parm").Cells(startRow + 0, Column + Cat).Value
MaxGLA = Sheets("Parm").Cells(startRow + 1, Column + Cat).Value
Flat = Sheets("Parm").Cells(startRow + 2, Column + Cat).Value
CeaseAge = Sheets("Parm").Cells(startRow + 3, Column + Cat).Value
Retention = Sheets("Parm").Cells(startRow + 5, Column + Cat).Value
MaxGLA = IIf(MaxGLA = 0, 100000000, MaxGLA)
If Mult = 99 Then
Mult = Sheets("AgeBands").Cells(Age - 9, Column + Cat).Value
End If
GLA = Mult * Sal + Flat
GLA = IIf(GLA > MaxGLA, MaxGLA, GLA)
GLA = IIf(GLA > Retention, GLA - Retention, 0)
GLA = IIf(Age > CeaseAge, 0, GLA)
End If
End Function
This is then called from each cell as =GLA(...parameters)
Another point: I added the Application.Volatile part because calculations were constantly "lagging behind". I.e. unbeknownst to me the cells in question (and all subsequently dependent cells) were not updating their calculations.
Much appreciated
Karl
|
|
|
|
|
Usually, you get the #VALUE error if you try to do math on String cell content. Something like =A1+4/"Text" .
|
|
|
|
|
Yes but that isn't whats happening here
|
|
|
|
|
The error you're seeing the cells is saying otherwise...
|
|
|
|
|
All right then, let's explore this.
Is it possible that the calls to Sheet("Parm").Cells(...) is returning the values from the wrong location? I can't see why excel would be confused if I explicitly state the sheet name and cell number, but maybe this is the case.
Or could it be that the parameters being passed are wrong? This function is invoked with: =GLA(A1,B1,C1...) in the relevant spreadsheet. Could excel become confused about where "A1" etc are? I've tried making this "SheetName!A1" etc but to no avail.
Whenever this error occurs I get a thousand rows of #VALUE, but the moment I click in a single one of those cells excel corrects itself.
|
|
|
|
|
Try working with named ranges instead of calculating which cells on the fly, it will enforce which sheets are being referenced.
|
|
|
|
|
Hi all,
I have an Object which I don't know what property it has.
Can I list all the property of that object and later get the value of each property?
TIA
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
use the "Sender.ToString" in any one of the events.
it contains the info abt what the object is.
for eg, if you do this in click event of button1
"msgbox(sender.tostring)"
gives this:
System.Windows.Forms.Button, Text: Button1
TheMrProgrammer
|
|
|
|
|
TheMrProgrammer wrote: use the "Sender.ToString"
I can understand that your answer is restricted to vb.net control object, where the sender exist, but I am talking for object that is not a control.
but, let talk about button control.
I have Button1 as control in my form, how I can do something like this
For each Property in button1.properties<br />
debug.print(Property.Name)<br />
debug.print(Property.Value)<br />
Next<br />
TIA
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
You have to use Reflection to get at the properties. There's a ton of tutorials out there. All you have to do is search for them[^].
|
|
|
|
|
Thank you for your help.
I found what I am searching for.
I did not know that GetType() is reflection.
My problem is still not solved.
I am trying to get the properties in WMI service with no luck. I will continue testing and when I get stuck I will post my question.
Best Regards
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
You never mentioned WMI until now. That changes the question and it's answer immensly. Now, you don't use Reflection to do this. You use the Properties collection of the ManagementObject you're getting back from your WMI query.
For Each prop As PropertyData In wmiObj.Properties
Console.WriteLine("Property Name: " & prop.Name & " Value: " & prop.Value)
Next
|
|
|
|
|
Dave Kreskowiak wrote: You never mentioned WMI until now. That changes the question and it's answer immensly
I feel kinda lost and surprised a little.
Why should I mention that the PEM's is for WMI? is WMI is handled in diff way in vb.net?
I know you are right, since my reflection GetType() does not work with it and I am still trying to work with ManagementObject.
Could you explain please? and is there others kind of object I should take care about?
TIA
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Getting the properties of a .NET object is very different from a WMI object. The .NET object is a native .NET CLR type, whereas a WMI object is backed by a COM object, not native to the CLR.
|
|
|
|
|
Thank you for your explanation.
To much difference I should take care and learn.
In VFP, there is single "object" that handle all kinds of objects
Although there is an object can be accessed by "object.property", and other cannot be accessed unless you use "For Each"
Thank you very much.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
hi all
i am using this function in my app
<DllImport("USER32.DLL", EntryPoint:="SetLayeredWindowAttributes", SetLastError:=True, _
CharSet:=CharSet.Unicode, ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function _
SetLayeredWindowAttributes(ByVal hwnd As Integer, ByVal crKey As Integer, ByVal bAlpha As Byte, ByVal dwFlags As Integer) As Integer _
End Function
but the function is not working.
any guesses abt what is wrong here????
TheMrProgrammer
|
|
|
|
|
|
At a minimum, the hwnd parameter should be declared as an Intptr, not an Integer.
|
|
|
|