|
I was just wandering how to use some custom Menus and or Forms. I was just wandering was were somethings that would allow me to customize. I was also wandering about incorporating flash. How much of a task is this?
|
|
|
|
|
Custom menus or forms, where? As Web Forms or as Windows Forms?
Sorry, I'm not much help with Flash.
|
|
|
|
|
Custom menus are quite easy. You only set the OwnerDraw property to "true", specify the size of the menu item in the "MesureItem" event method, and draw the menu item in the "DrawItem" event method.
To customize a form, you can set "FormBorderStyle" to "None", change the "Region" property to whatever you like and draw the borders on the form's canvas.
For Flash you have to use the web browser control.
|
|
|
|
|
I am developing a large word document template that presents the user with a user form front end, collects the data on completion at goes on to be built by one of many build routines. Intending it to appear as close to a standalone application (VB not allowed!) as possible and controlling the users interaction as tightly as possible, I have taken control of all exit operations toolbar and menu's, document hiding, version and naming conventions etc. What remains to totally stymie myself and collegues are:
Modal seemed best option to adopt, binding the form and the document and ensuring control focus, this however presents us with the scenario that any word documents already open are not accessible! Their on the taskbar but clicking yields no change in application or document activation. Unfortunately our users are not guarenteed IT competents so the best instructions in the world are not going to prevent them having documents open prior to opening our template, as well as the fact that this just shouldnt happen! Any help in a workaround enabling normal multi window operation would be appreciated. Obviously were the documents only available through the windows menu like the old days this query would be mute but hopefully....
Secondly I would also like the give the user a virtual minimize facility without resorting to form resizing! maybe by shooting the window off screen with a command button. How though can I get it back by for example using the task bar icon. I have explored the document and form event handlers (inc hooked events) to no avail.
My apologies for such a long and verbose posting. JasH
|
|
|
|
|
I've created my own ocx control (with 2 option buttons y & n). I inserted that control in my project.
My question:how do I find out the value (y or n) from conrol?
Thanks
|
|
|
|
|
Your control is going to have to expose this property. What you are probably looking to do in your control is when a button is clicked, the code that handles that button click sets a property in your control with a value that is unique to that button, say 1 for the Y button and 0 for N button. Then your application can check the value of the property for which button was clicked.
Another method would be to have your control fire an event that includes which button was clicked (as above) in its arguments. In your control, something like this: (not actual code!)
Public Event ButtonClicked(ByVal ButtonID as Integer)
Button handling code:
Private Sub YButton_Clicked(...)
RaiseEvent ButtonClicked(1)
End Sub
Private Sub NButton_Clicked(...)
RaiseEvent ButtonClicked(0)
End Sub
RageInTheMachine9532
|
|
|
|
|
If I understood you correct. I add the following code into my contorll porject and them created new ocx.
Private Sub optYes_Click()
optYes.Value = True
End Sub
Private Sub optNo_Click()
optNo.Value = True
End Sub
Private Sub UserControl_Initialize()
optNo.Value = False
optYes.Value = False
End Sub
However, when I am placing that control in my main project I still can't see selected value. Please help me.
|
|
|
|
|
Wait a minute... My mistake, I thought you were using two command buttons.
OK. An OCX means your using VB6...
What you have to do is expose (make Public) your own custom Property. What you would normally do is define an global variable used internal to your control, like m_OptionPicked. You use the optYes and optNo click events to set the value of that variable, either a number or some predefined Enumeration, whatever you want your Property to expose. I'll use an Enum to demonstrate:
' Setup our Public enumeration values
' These are the possible values of our controls property.
Public Enum ControlOptions
Undefined = -1
Yes = 1
No = 0
End Enum
' Internal variables (visible only inside the control!)
' Declaring as 'ControlOptions' will limit the value to
' the possible values of our Enumeration above.
Private m_OptionPicked as ControlOptions
Now, when an option button is clicked, you handle the Click event just as you have in your previous post, BUT you set the value of m_OptionPicked to one of the predefined values of ControlOptions, like this:
Private Sub UserControl_Initialize()
m_OptionPicked = ControlOptions.Undefined
End Sub
Private Sub optYes_Click()
m_OptionPicked = ControlOptions.Yes
End Sub
Private Sub optNo_Click()
m_OptionPicked = ControlOptions.No
End Sub
Almost done! Now you have to expose the internal variable as a Property of your control. You can do this using the Property statements. We're going to make a property called OptionPicked that your control exposes to its host. The code in the Property statement will just return the value of the internal variable m_OptionPicked. Once again, we'll declare that the value returned is one of the possible values of ControlOptions above.
Public Property Get OptionPicked() as ControlOptions
return m_OptionPicked
End Property
Since we have only a Property Get defined for OptionPicked, is automatically becomes a Read-Only property. That is, your application can only read the value of OptionPicked, it can't set a new value for it. If you wanted to do that, you would have to define a block of code for a Property Set statement so your control knows what to do with the new value:
Public Property Set OptionPicked( NewValue as ControlOptions )
m_OptionPicked = NewValue
' Some addition code to alter the status
' of the option buttons on screen should go here.
End Property
That's all there is to it! This is a little more code than required to expose the value of an option button, but more complex controls would follow this framework.
Let me know how it goes!
RageInTheMachine9532
|
|
|
|
|
I have some dificulty to compile tha code with the following lines:
Public Property Get OptionPicked() As ControlOptions
return m_OptionPicked
End Property
Public Property Set OptionPicked(NewValue As ControlOptions)
m_OptionPicked = NewValue
End Property
Please help me. Thanks
|
|
|
|
|
You have to include what the error/problem is!
RageInTheMachine9532
|
|
|
|
|
Return isn't supported in VB6. Try
Public Property Get OptionPicked() As ControlOptions
OptionPicked = m_OptionPicked
End Property I think you're OK with the Set part.
|
|
|
|
|
My bad! That's what I get for writting VB6 code from memory!
The fixed line should be:
Public Property Get OptionPicked() As ControlOptions
OptionPicked = m_OptionPicked
End Property
RageInTheMachine9532
|
|
|
|
|
Here is my code with your modification:
Option Explicit
Public Enum ControlOptions
Undefined = -1
Yes = 1
No = 0
End Enum
Private m_OptionPicked As ControlOptions
Private Sub UserControl_Initialize()
m_OptionPicked = ControlOptions.Undefined
End Sub
Private Sub optYes_Click()
m_OptionPicked = ControlOptions.Yes
End Sub
Private Sub optNo_Click()
m_OptionPicked = ControlOptions.No
End Sub
Public Property Get OptionPicked() As ControlOptions
OptionPicked = m_OptionPicked
End Property
Public Property Set OptionPicked(NewValue As ControlOptions)
m_OptionPicked = NewValue
End Property
And here is the error:
Compile error:
Definitions of property procedures for the same property are inconsistent, or property procedure has
an optional parameter, as ParamArray, or an invalid Set final parameter
|
|
|
|
|
Once again, my bad! Change the Set to Let:
Public Property Let OptionPicked(NewValue As ControlOptions)
m_OptionPicked = NewValue
End Property
The Set version is used for setting object references...
RageInTheMachine9532
|
|
|
|
|
It is not your bad it is my luck of knoledge that I can't figure out by myself.But I am learning
I was able to compile the ocx project and then use it in my main project, however I still can't see the value.
UserControl11.Value ????
|
|
|
|
|
Thats because it's called OptionPicked, not Value.
RageInTheMachine9532
|
|
|
|
|
I love you... Thanks for the help...
|
|
|
|
|
Hi there;
Can any one please help me on "how to Embed Progress Bars in a List Control".
Thanks;
|
|
|
|
|
Did you take a look at this example http://www.codeproject.com/listctrl/napster.asp?
|
|
|
|
|
I wish to do a UML and implementation mapping in different programming languages,such as visual basic and C# but i have no idea on where to start or where to find any info, googling wasn't much help either...
Any ideas anybody??
|
|
|
|
|
Do you want an environment that will generate source code from UML, or generate UML from source code?
|
|
|
|
|
Not really but what i need is to show the contrast between the different languages's UML diagram, like how it is implemented in UML for java, comapring to a visual basic UML diagram and so on..where can i find resources for this info?
|
|
|
|
|
Since UML is independent of implementation or deployment (it is, by definition, a modeling language) a diagram shouldn't differ for different language implementations; ideally, you are creating use-cases (language-independent), state diagrams (language-independent), packages and classes, with properties, events and methods, and building or modeling the problem domain and a solution set in an abstract manner, trying to define the best or best practicable architecture for a system.
True, if you are planning on implementing something in VB6 rather than VB.NET, C# or Java, you don't get to inherit or interface in a manner that is as elegant as the latter, so in that case, your classes could be a bit one-dimensional...
Then again, that's just my opinion, I could be wrong.
Anyone else out there care to discuss?
|
|
|
|
|
Hey,
I found an article on this site, about the Cabinet.dll, which enables compressing and decompressing (multiple) files. Now I want to use this DLL in an application, but haven't got an idea (VB.NET app) because I'm pretty new to VB.NET. Has anybody got an example or hint about using this DLL??
|| Kewl, it works ||
|
|
|
|
|
Respected sir/madam,
I would like to know how to store an image in the backend of an access using ADODB control with VB6 acting as a front end.
PRAVEED
|
|
|
|