|
try this :
In Form1:
<font color="blue">Private</font><font color="blue"></font> <font color="blue">Sub</font> Button1_Click(<font color="blue">ByVal</font> sender <font color="blue">As</font> System.Object,<font color="blue"></font> <font color="blue">ByVal</font> e <font color="blue">As</font> System.EventArgs) <font color="blue">Handles</font> Button1.Click <br> <font color="blue"></font><font color="blue"></font> <font color="blue">Dim</font> frm2 <font color="blue">As</font> <font color="blue">New</font> Form2() <br> <font color="blue"></font><font color="blue"></font> Me.AddOwnedForm(frm2) <font color="DarkGreen">'/// add it as an owned form. <br></font><br> <font color="blue"></font><font color="blue"></font> frm2.Show() <font color="DarkGreen">'
In Form2:
<font color="blue">Private</font><font color="blue"></font> <font color="blue">Sub</font> Button1_Click(<font color="blue">ByVal</font> sender <font color="blue">As</font> System.Object,<font color="blue"></font> <font color="blue">ByVal</font> e <font color="blue">As</font> System.EventArgs) <font color="blue">Handles</font> Button1.Click <br> <font color="blue"></font><font color="blue"></font> <font color="blue">Dim</font> frm1 <font color="blue">As</font> Form1 = Me.Owner <br> <font color="blue"></font><font color="blue"></font> frm1.TextBox1.AppendText("some text from Form2 , to Form1!") <br> <font color="blue">End</font><font color="blue"></font> <font color="blue">Sub</font> <br>
hope it helps
Vb:
<font color="blue">Public Function</font> TwinsOnWay(<font color="blue">ByVal</font> twins <font color="blue">As String</font>) <font color="blue">As String <br> Select Case</font> twins<br> <font color="blue">Case</font> "Gender" <br> <font color="blue">Return</font> "Two Girls" <br> <font color="blue">End Select <br> End Function</font> <br>
|
|
|
|
|
Thanx A LOT!!! I am going to try it! I knew the answer is easy, but you know how it goes - one always looks for the most difficult solution...
Good luck with the twins...
If I can't get it to work, you will hear from me again...
|
|
|
|
|
Hi
I would like to use a certain VB functions in Vc++.
It was recommended to me to make an ActiveX DLL in VB, and call VB ActiveX DLL in VC.
How can I make a VB ActiveX DLL?
Ehsan Behboudi
|
|
|
|
|
start a new project ..
choose ActiveX DLL
in the project add Class modules with functions , propertties you need..
then build the project.
is this all waht you need ?
|
|
|
|
|
So, I should make an ActiveX Dll project and add all the functions/constants to it, then build it?
how can I use the functions in my VC++ program.
should I just type the functions down in the VB, how can I add them?
Ehsan Behboudi
|
|
|
|
|
Hi,,
using it in VC++ is a long story
in brief look MSDN for CoCreateInstance
you can add functions , properties to the VB6 project :
choose Tools menu then Add Procedure
|
|
|
|
|
I am using multithreading in a program, but since I have never done so before I have some questions as to optimal use. Take the following example:
I have an COM object lets call it "comObj" which has a function "SendData". Since the program operates under heavy volume calling "Senddata" concurrently on seperate threads is desirable.
So now my question, if I call the same function on the same object in multiple threads will I really experience a performance gain? Or do I have to create multiple objects (created inside thread) to see a performace gain?
code:
[code]
'...in some function
Dim comObj as (whatever object)
'these are passed by reference
Dim mySend1 as new OutThread(comObj)
Dim mySend2 as New OutThread(comObj)
'...destroy objects...
Public MustInherit Class ThreadWrap
' i use a threadwrapper because multiple thread subtypes
Protected m_Thread As Thread
Public Sub New()
m_Thread = New Thread(AddressOf run)
End Sub
Public Sub start()
Me.m_Thread.Start()
End Sub
Public MustOverride Sub run()
End Class
Public Class OutThread
Inherits ThreadWrap
dim m_objCom as object
Public Sub New(ByRef comObj As Object)
m_Thread = New Thread(AddressOf run)
m_objCom = comObj
End Sub
Public Overrides Sub run()
'this is the sameobject used in both threads
m_comObj.SendData
End Sub
End Class
[/code]
Now the alternitive I see would be to not delcare your object first and then create and destroy it inside the Run() function, but that would require twice as many calls to the constructor and destructor, plus of course more overall memory.
So logically I would hope the method above does utilize multiple threads, but do all threads have to wait on that one object and does that create a bottle neck? Any clarification would be great thanks.
~rlcc
|
|
|
|
|
Multiple threads will generally give you gains over single thread on these situations:
1. More responsive UI;
2. There's something the CPU could be doing while it's waiting for an I/O operation;
3. You have multiple CPUs;
4. You have a Pentium 4 with HyperThreading, on some specific situations;
Notice that you won't have CPU gains, actually, as you've noticed, you will spend more CPU to do real parallel work; so, the general rule is only to MT if your CPU is waiting for something.
ORACLE One Real A$#h%le Called Lary Ellison
|
|
|
|
|
Hi
How can i get the width of a col in a datagrid?
|
|
|
|
|
how to get sounds effects to my programin VB6
example : when i press a button a song plays and so on
BUT without running its program(winamp,windows media player,...etc)
please reply to me
ahmed
ahmed elmahdy
|
|
|
|
|
Use the sndPlaySound[^] API.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Do you know how to create outlook style interface ? Thanks.
Frances
|
|
|
|
|
Easy. Just combine several pannels and splitters and use the docking property.
|
|
|
|
|
i am trying to get the number of files returned when you use the getfiles function so i dont have to run through them first. the getlegth part accepts a parameter called dimension which is a zero based array but i dont know what to give it any help would be much appreciated
|
|
|
|
|
System.IO.DirectoryInfo.GetFiles() returns an array of FileInfo. You should be able to use the Length property of the array to find out how many there are.
GetLength() is for multi-dimensional arrays; you can specify 0 for the dimension to get the length of a single-dimension array.
--
Mike Dimmick
|
|
|
|
|
Hi, Can anyone tell me if it's possible to set the foreground and/or background colors of individual cells in the Window Forms DataGrid control ? Also, is it possible to allow the user to select more than one cell at a time ? If so, some example code (ideally VB.NET) would be brilliant
I have to create a 'booking calendar' type grid showing provisional and confirmed bookings in different colours and I'd like to allow the user to click & hold and move (drag) the mouse to book a week or a variable number of days.
Alternatively, does anyone know of a better suited grid control that could handle such a use ? Previously (in VB6) I Used the FlexGrid control for vaguely similar uses, but that control doesn't seem to exist in .NET.
Many thanks.
Iain.
|
|
|
|
|
you can still use a flexigrid in .net , just right click on your toolbox and click "Customise toolbox" , on the window that opens, choose "COMM" and then you will find the flexigrid control in that list, it will be added to your toolbox and you can then use it as before in vb6.
Vb:
<font color="blue">Public Function</font> TwinsOnWay(<font color="blue">ByVal</font> twins <font color="blue">As String</font>) <font color="blue">As String <br> Select Case</font> twins<br> <font color="blue">Case</font> "Gender" <br> <font color="blue">Return</font> "Two Girls" <br> <font color="blue">End Select <br> End Function</font> <br>
|
|
|
|
|
I have a project in VB6, an accounting package, that is so far working perfectly. The only problem now is deployment
In a nutshell: at the moment I'm using NSIS[^], which (I thought) was working fine for me. The only problem is that when the program is installed on a machine that doesn't have VS installed, it refuses to work. The reason for this is that it's missing runtimes. I've tried packaging the VBRun60sp4.exe[^] file, but that also doesn't seem to help. As a last resort I've tried using the P&D Wizard, which auto-updates system files, but all it does is updates the files, asks for a reboot, when rebooted I try it again, and the same thing happens: it 'installs' system files and asks for a reboot again
Please help
Paul
Live in such a way that you would not be ashamed to sell your parrot to the town gossip. - Will Rogers
modified 18-Jul-18 11:59am.
|
|
|
|
|
Solved.
Paul
Live in such a way that you would not be ashamed to sell your parrot to the town gossip. - Will Rogers
modified 18-Jul-18 11:59am.
|
|
|
|
|
how do i read xml files using adodb
is there any odbc-driver available
can someone direct me to some samples
thanx
rIsHaBH
|
|
|
|
|
rs.Open "FilePath",con,,,adCmdFile
where:
rs:the name of the recordset object
con:active connection
|
|
|
|
|
Hi,
I have a very "simple" problem, but i dont know how to sove it. I want to show a contextmenu, where one menu item is a textbox (ex. Right click on a cell of a open access table in access).
Can anyone help me?
almigrp (Misel)
|
|
|
|
|
Hello,
how can I create a VB.NET project who add features (as add-in for example) to Excel ?
Best Regards
Alfredo DS
Alfredo DS
|
|
|
|
|
For Office 10 use the Office Primary Interop Assemblies provided by Microsoft.
|
|
|
|
|
I am trying to call a VB dll from ASP.net code behind. This is fine.
Then, this DLL calls a function of VB ActiveX exe. This is where application breaks. It says some "Security Exception" issue.
Have any one faced this issue? Please suggest what should be done to resolve this. Thanks
~~~~Pankaj~~~~
Follow your goals, Means will follow you ---Gandhi---
|
|
|
|