473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

passing parameters

Hi

How can I pass a string from a form to a dialog which I am trying to open
from the same form?

Thanks

Regards
Nov 20 '05 #1
6 1250
Cor
Hi John,
Thousand possibilties,
I just make a public string in my dialogform let say
(pseudo code)
\\\
public a as string
///
and then in the main form
\\\
dim frm as new formdialog
frm.a = "John"
frm.showdialog
dim answer as string = frm.a
frm.dispose
///
Maybe not nice, but for a dialogform I found it nice enough

I hope this helps a little 1/8 byte?
Cor
Nov 20 '05 #2
Excellent for my situation. Just what I was looking for. Many Thanks.

Regards
"Cor" <no*@non.com> wrote in message
news:3f***********************@reader20.wxs.nl...
Hi John,
Thousand possibilties,
I just make a public string in my dialogform let say
(pseudo code)
\\\
public a as string
///
and then in the main form
\\\
dim frm as new formdialog
frm.a = "John"
frm.showdialog
dim answer as string = frm.a
frm.dispose
///
Maybe not nice, but for a dialogform I found it nice enough

I hope this helps a little 1/8 byte?
Cor

Nov 20 '05 #3
"Cor" <no*@non.com> wrote in news:3f8d479f$0$25258$48b97d01
@reader20.wxs.nl:

Hi Cor,

I think he wanted to pass the string TO the dialog.

One way would be to overload the ShowDialog method to take a string and
pass in the string when the dialog form is shown:

'In the dialog form

Private m_SomeString As String

Public Overloads Function ShowDialog(sParm As String) As DialogResult
m_SomeString = sParm
Return MyBase.ShowDialog()
End Function
'Then in the form that opens the dialog,
' pass in the string to the constructor:

Dim fDialog As New DialogForm()

fDialog.ShowDialog("String to pass to the Dialog")
HTH

Chris
Nov 20 '05 #4
Cor
Chris,
I think he wanted to pass the string TO the dialog.


I did in my exampe, TO and FROM.
\\\
frm.a = "John"
frm.showdialog
dim answer as string = frm.a
///

I know it is not nice but that dialogbox lives just some seconds.

And mostly it is a very simple form,

When it would be a special dialogclass for all dialogs, I would sure do it
in the way you describe.

Cor

Nov 20 '05 #5
"Cor" <no*@non.com> wrote in
news:3f***********************@reader20.wxs.nl:
I did in my exampe, TO and FROM.


My mistake, I didn't read closely enough.

Chris
Nov 20 '05 #6
John,
As Cor stated you can use a Property, which is consistent with the Framework
(OpenFileDialog for example).

In addition to the property I will also sometimes add an overloaded
constructor to the dialog that accepts the value I want to pass in. However
I normally only use this when I am passing readonly data, such as the
caption of the dialog or a reference to an object that the dialog operates
on. Because the object is a reference the dialog can modify the object
itself.

Hope this helps
Jay

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:et**************@TK2MSFTNGP10.phx.gbl...
Hi

How can I pass a string from a form to a dialog which I am trying to open
from the same form?

Thanks

Regards

Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: zlatko | last post by:
There is a form in an Access Project (.adp, Access front end with SQL Server) for entering data into a table for temporary storing. Then, by clicking a botton, several action stored procedures...
7
by: Pavils Jurjans | last post by:
Hallo, I have been programming for restricted environments where Internet Explorer is a standard, so I haven't stumbled upon this problem until now, when I need to write a DOM-compatible code. ...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
12
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
39
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
17
by: Charles Sullivan | last post by:
The library function 'qsort' is declared thus: void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); If in my code I write: int cmp_fcn(...); int...
4
by: Mike Dinnis | last post by:
Hi, I've been working through a number of turorials to try to learn more about retrieving data from a SQL database. I think i've mastered techniques where i create a sql string in the page and...
2
by: csmith8933 | last post by:
How do I write a function where the number of parameters it takes varies? This is what I have but it doesnt work. // function prototype void functionThree(int num1=1, int num2=2, int num3=3);...
3
by: ajaymohank | last post by:
hello everyone..... i am ajay and i am new to php. in my project i have an option to invoke a bat file by passing parrameters and to diplay the result. i tried this code but my page got hung or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.