|
mns01 wrote: dnt knw wats
mns01 wrote: wid ya
mns01 wrote: jst nw
mns01 wrote: v
mns01 wrote: jst
mns01 wrote: dnt knw
mns01 wrote: m askin
Please do not write in "txtspk". This is not a chat room, nor a text message. By writing in "txtspk" it makes your message more difficult to understand, and marks you out as being lazy or willing to take unecessary shortcuts.
mns01 wrote: i dnt knw wats wrong wid ya people...
There is nothing wrong with us. Insulting those who are tying to help you is not conducive to receiving a satisfactory answer. And, as you will see from the rest of the message, the question is not as simple to answer as you might think (assuming, of course, that the assumptions that I've made about what you actually want to do are correct)
mns01 wrote: this problem is as simple as opening a new form when we click a button.
its jst nw in place of form v have a text file
You want to open a text file. And apparently this is as easy as opening a form. Since a text file is, as I've said before, inert then you need something to act on it as it cannot perform any actions itself. So, I'm going to make a guess that you want to open a form with the text file loaded into it. Is that right?
So, create a form, with a large multi-line text box in it.
In the form's Load event handler you will load the text file into the form.
mns01 wrote: which i have already added by 'adding new object' option....
Exactly how did you add that? As content (in which case it gets copied to the same directory the exe is built into) or as a resource (in which case it gets embedded into your exe)?
Depending on how you added it, changes the way you get to show it.
|
|
|
|
|
Thanks colin...
for giving such a nice reply and solving my problem.
|
|
|
|
|
I am not sure if this will solve your problem. Why not show the contents of the textfile in multi-line textbox?
|
|
|
|
|
I'm still struggling here. Please bear with me.
I have a main .exe file with two classes: Class A and Class B
I have an assembly .dll file with one class: Class C
Class A in the .exe calls Class C in the .dll
Is it appropriate for Class C (.dll) to then call back up to Class B in the .exe? Or is it only appropriate to put Class B in its own assembly where Class C can call it .dll to .dll?
Thank you
|
|
|
|
|
cstrader232 wrote: Is it appropriate for Class C (.dll) to then call back up to Class B in the .exe?
If it does you have a circular reference between assemblies. This indicates that you have either not put the classes in the correct assemblies, or that your design is incorrect.
cstrader232 wrote: Or is it only appropriate to put Class B in its own assembly where Class C can call it .dll to .dll?
It all really depends on the relationship between the classes. If A, B and C represent different tiers of the application (e.g. A is the presentation layer, C is the business layer and B is the data layer) then they should go in different assemblies. But if B and C both represent different parts of, say, the business layer then they should be in the same assembly.
|
|
|
|
|
Oh, I think I forgot to mention something important, which is that the assembly is not linked to the .exe via imports in the .exe -- it is only 'discovered' via reflection at runtime.
|
|
|
|
|
It really is a lower-level assembly, which is part of my confusion. I'm having trouble figuring out how to tell the .dll to callback to the host, because the .dll of course doesn't know of the host's existence.
After I link the .dll via reflection, I've been passing the host name as an object from the .exe
initializeassembly (Me, ClassB)
to the .dll:
public shared host as object
public shared ClassB as Object
sub initializeassembly (host, ClassB)
me.host = host
Me.ClassB = ClassB
end sub
then I can call back up to the main from the .dll:
either the calling class
Me.host.method()
or another class in the main:
me.ClassB.Method()
But this procedure seems to not be that reliable.
I was told to use a delegate, but I don't see how that solves my problem(s)!
Does this make any sense?
thanks again.
|
|
|
|
|
cstrader232 wrote: I'm having trouble figuring out how to tell the .dll to callback to the host, because the .dll of course doesn't know of the host's existence.
Have a look at events. Think of the way controls on forms inform your code (which obviously, the button, text box or whatever, knows nothing about) of things happening to them.
Or, you could have the host implement an interface that both host and dynamically loaded assembly know about. Have a look for information on the "Plug in" pattern to see how to do that.
|
|
|
|
|
OK, yes an interface. Could I bug you once more though, because I can create it, but not access it.
In the main form:
Interface IMyInterface
Sub A (byval X as string)
End Interface
Class A
implements IMyInterface
Sub A (Byval X as string)
End Sub
End class
But how to refer to the Interface from the dynamically loaded .dll?
in the .dll:
Interface IMyInterface
Sub A (byval X as string)
End Interface
Class B
dim iff as IMyInterface
...?
End Class
Thanks so much!
|
|
|
|
|
cstrader232 wrote: But how to refer to the Interface from the dynamically loaded .dll?
You put the interface in a (third) common assembly so that both the exe and the existing dll can reference it.
|
|
|
|
|
OK, I think I get that part... but how do I create an instance of the interface? I can dim the interface in the assembly:
Dim mm As myInterfaceAssembly.Imyinterface()
but then
mm.method
gives me "Object reference not set to an instance of an object.
From the .dll
imports myInterfaceAssembly
class A
Sub Test
Dim mm As myInterfaceAssembly.Imyinterface()
mm.method()
end sub
End class
thanks again
|
|
|
|
|
cstrader232 wrote: but how do I create an instance of the interface?
You don't create an instance of the interface; you can't as there is nothing to instantiate. The appropriate class inherits the interface (remember, you can inherit multiple interfaces). You then instantiate an instance of the class. The object can then be assigned to a variable of the interface type.
|
|
|
|
|
Sorry, I still don't get it. Could you stay with me for a minute (anyone else care to chime in?)
You don't create an instance of the interface; you can't as there is nothing to instantiate.
OK
The appropriate class inherits the interface (remember, you can inherit multiple interfaces).
I don't see how you inherit an interface. Perhaps you mean that the class with the methods to be used _implements_ the interface? OK, I see that
You then instantiate an instance of the class.
But I can't do that because the class does not exist in my dynamically created .dll
I thought that the interface .dll would allow my plugin .dll to find the class from the main .exe at runtime. I still don't see how to do that.
thanks again
|
|
|
|
|
cstrader232 wrote: I don't see how you inherit an interface. Perhaps you mean that the class with the methods to be used _implements_ the interface?
I'm primarily a C# developer and in C# you inherit (or implement) an interface. So, yes, you implement the interface in the class.
cstrader232 wrote: But I can't do that because the class does not exist in my dynamically created .dll
Sorry, I though it was the class in the DLL that was inheriting (implementing) the interface.
If it is in the main exe, then shouldn't the class already be instantiated? (You might want to show some pseudo code so I understand what you are trying to do)
cstrader232 wrote: I thought that the interface .dll would allow my plugin .dll to find the class from the main .exe at runtime. I still don't see how to do that.
I think you are going the wrong way around. It should help the code in your EXE use the dyanmically created class in the dynamically loaded DLL.
Anyway, some pseudo code of what you are trying to achieve (with or without interfaces) would be most beneficial at this point.
|
|
|
|
|
I am using VBA 6.3 and MS Access 2003.
I have a combobox set from a RowSource (a query on a table).
The bound column is a hidden column, width 0"
How do I set the selection for the combobox via vba code, e.g. set it to first, last or say 3rd item in the query?
DLipkie
|
|
|
|
|
The following will work
1) Make sure that the bound column is the first column
2) Make sure the first column is the only visible column
3) Use combo1 = "text" to set the text content of the combo
4) If you have a combo changed event handler then explicitly call it, the assignment in (3) doesn't seem to be sufficient to invoke the handler.
I've not tested
a) having multiple non-visible columns
b) having the bound column be non-visible
This may not be the most general solution but it works for my situation.
DLipkie
|
|
|
|
|
Also I had to explicitly set the focus to the combobox before assigning the text,e.g.
form1.combo1.SetFocus
DLipkie
|
|
|
|
|
I've got an MSHFlexGrid on a form and it is set up to not highlight cells or rows when the user clicks. Howver, I've put code behind the click event to check the background color of the cell in which the user clicked. If it is not yellow, I set the background color of all cells in the row to yellow. If it is yellow (i.e., selected) I set the background color back to white.
What I want to do is to allow the user to select multiple rows by holding the shift key down while they click but this doesn't seem to be working. When the shift key is held down during the click event, the row that is selected appears to be the same row that was selected when the first cell was clicked in rather than the actual row in which the mouse click event occurred. Does anyone know how I can get tis to work the way I described?
|
|
|
|
|
I finally figured out my problem. I was looking at the .row property instead of the .rowSel property. Once I figured this out the rest was relatively easy.
|
|
|
|
|
Hello there
I could finish writing some other programs and thanks to Cleako for the previouse help!
My second problem is that in the forms that I have designed I want to put a button for printing option. How this can be done? I mean connecting to the printer? May anyone help me with this?
email: fight_2_death@hotmail.com
╦َ║▐
|
|
|
|
|
In toolbox there is printdialog options. Simply drag it and drop it onto form and then you will able to use it inside your code. For example I want to open a print dialog when user clicks a button.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PrintDialog1.ShowDialog()
End Sub
However, there are more things to do for printing for example you should bind the content for a specific document.
I hope that helps
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
I recently posted up an article here[^] with a control to do just that - worth a try...
|
|
|
|
|
Is there a specific version of VS 2005 or add on to get this interop service?
|
|
|
|
|
You might want to look at this[^] page for more information on the Office PIA's. There's more info on installing them here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
In my software when I'm in a textbox(multilined) and press Ctrl+T a text box must appear beside the cursor(no matter where the cursor is).
pls Help very urgent.
|
|
|
|