How to use data on two forms

I have two forms. A button on form1, and when i click on button1 my
form1, form2 is open. Add some data to form2, and write it on form1,
all with class.
How to do that?
0
imarkic
1/7/2010 3:51:27 PM
dotnet.languages.vb 830 articles. 0 followers. Follow

5 Replies
881 Views

Similar Articles

[PageSpeed] 23

imarkic <imarkic84@gmail.com> wrote in news:009b8c57-bc47-409a-8f3a-
e995e1944f19@j5g2000yqm.googlegroups.com:

> I have two forms. A button on form1, and when i click on button1 my
> form1, form2 is open. Add some data to form2, and write it on form1,
> all with class.
> How to do that?
> 

This really depends on the model you are using. In general, you will not 
control it from an outside class. Instead, you will fill the second form 
if it is child (MDI window is a good example) or raise events to get the 
other direction.

There are other ways, but you will often end up with a tightly coupled 
system if you try them, which is not good.

Peace and Grace,


-- 
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
|      Think outside the box!             |
*******************************************
0
Gregory
1/7/2010 4:15:13 PM
imarkic schrieb:
> I have two forms. A button on form1, and when i click on button1 my
> form1, form2 is open. Add some data to form2, and write it on form1,
> all with class.
> How to do that?

Forms are just objects.

http://msdn.microsoft.com/en-us/library/b86b82w0.aspx


OT: Anybody else also doesn't see the TOC anymore on MSDN? Seems
they've tried to improve something lately. ;->

-- 
Armin


0
Armin
1/7/2010 4:52:42 PM
But could you give me example. I understand objects, inheriance but
there i have confusing

On 7 sij, 17:52, Armin Zingler <az.nos...@freenet.de> wrote:
> imarkic schrieb:
>
> > I have two forms. A button on form1, and when i click on button1 my
> > form1, form2 is open. Add some data to form2, and write it on form1,
> > all with class.
> > How to do that?
>
> Forms are just objects.
>
> http://msdn.microsoft.com/en-us/library/b86b82w0.aspx
>
> OT: Anybody else also doesn't see the TOC anymore on MSDN? Seems
> they've tried to improve something lately. ;->
>
> --
> Armin

0
imarkic
1/7/2010 6:15:04 PM
imarkic schrieb:
> But could you give me example. I understand objects, inheriance but
> there i have confusing

I hook up with Gregory. It depends...

The main difference is whether you show Form2 modally (ShowDialog)
or modeless (Show). If Form2 is modal, you can still access the controls
on Form2 from Form1 after Form2 has been closed. Example:

   using f2 as new form2
      if f2.showdialog = dialogresult.ok
         me.textbox1.text = f2.combobox1.text
      end if
   end using


Otherwise I could write a lot more, but it depends on what exactly
your goal is. As Gregory wrote, you can raise an event inside Form2
and handle it inside Form1. You can access the controls of Form2
or you can add properties to Form2 that return what you need.
Or the data can be passed as arguments of the event handler.


....

Here's a walkthrough for dialog boxes:
http://msdn.microsoft.com/en-us/library/cakx2hdw.aspx


-- 
Armin



0
Armin
1/7/2010 7:06:15 PM
I0ve succede but now with members of my class!

On 7 sij, 20:06, Armin Zingler <az.nos...@freenet.de> wrote:
> imarkic schrieb:
>
> > But could you give me example. I understand objects, inheriance but
> > there i have confusing
>
> I hook up with Gregory. It depends...
>
> The main difference is whether you show Form2 modally (ShowDialog)
> or modeless (Show). If Form2 is modal, you can still access the controls
> on Form2 from Form1 after Form2 has been closed. Example:
>
> =A0 =A0using f2 as new form2
> =A0 =A0 =A0 if f2.showdialog =3D dialogresult.ok
> =A0 =A0 =A0 =A0 =A0me.textbox1.text =3D f2.combobox1.text
> =A0 =A0 =A0 end if
> =A0 =A0end using
>
> Otherwise I could write a lot more, but it depends on what exactly
> your goal is. As Gregory wrote, you can raise an event inside Form2
> and handle it inside Form1. You can access the controls of Form2
> or you can add properties to Form2 that return what you need.
> Or the data can be passed as arguments of the event handler.
>
> ...
>
> Here's a walkthrough for dialog boxes:http://msdn.microsoft.com/en-us/lib=
rary/cakx2hdw.aspx
>
> --
> Armin

0
imarkic
1/7/2010 10:30:14 PM
Reply:

Similar Artilces:

Change tab color when a tab is used #2
Version 1 -- eluehman ----------------------------------------------------------------------- eluehmann's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1309 View this thread: http://www.excelforum.com/showthread.php?threadid=26242 you can only do this in office 2002 onwards. this goes into the sheet' code module. Private Sub Worksheet_Activate() Me.Tab.ColorIndex = 3 'this would give "Sheet1" a red underline End Sub i tried this, and i dont think it is too useful. as it is, when yo click on a tab, that tab's name is shown with a whit...

Passing criteria to queries from forms
I am putting together a database to record telephone surveys for a number of companies within a parent group. Each survey is allocated to the specific group company to which it belongs. I have created a report based on criteria (dates and group company at the moment) which is passed from a form to the query underlying the report - I can therefore generate reports on any date range and on any single group company. However, I need to be able to generate a report on all group companies combined but am not sure how to reflect this in the query crieteria. My idea so far is to set the ...

Using Exchange to book boardroom
We've been running Exchange 2k3 for about 3 months now... and everything works great. We'd now like to use exchange to book/manage some of our board rooms. I've read about a couple of ways to do it. Anyone have any suggestions on the 'best' way? ;-) Thanks! You need to setup resource mailboxes for your conference room(s) and either a) set them up to autoaccept meeting requests when there are no conflicts or b) use the AutoAccept Agent (recommended). http://www.microsoft.com/downloads/details.aspx?FamilyID=3D0884E6-C603-491D-BF57-ACF03E046BFE&displaylang=en Configu...

Annoying warnings when accessing data using ADO
I'm using ADO to access a custom attribute I added to a CASE Entity. The process works fine for my purposes but I get two annoying warnings that the method and provider I'm using may be unsafe. Both are cleared when the OK button is clicked and the data I'm seeking is correctly returned. Is there a way to prevent these warning from poping up? Use Microsoft CRM Webservices for accessing MS CRM data rather than ADO. As this is not recomented approach . Only using webservices is recommended. -- Happy Programming........ Thanks, Imran www.pkblogs.com/microsoftcrm3 "...

match data
I need help asap? I want to match information in four columns ex name test1 name test2 tina 86 mark 75 mark 80 tina 85 jim 45 jane 86 jake 51 mary 95 Not every one who took test1 took test2. I want to have the test1 and test2 grades for the students across the same row for those who took both test name test1 test2 name test2 test1 tina 86 85 mark 75 80 mark 80 75 tina 85 86 jim 45 #N/A jane 86 #N/A jake 51 #N/A mary 95 #N/A I used vlookup ...

form letter
I get new leads I want to put in as Contacts and then send an editable form letter ...

Generate a graphical formula from a column of data
If I have a set of data, is there any way I can generate a formula which roughly matches the plot of the data set? I know I can generate a trend line on a chart but is there a way of finding out the formula for this trendline, so that I could reproduce it without the origiinal data perhaps? Hope I'm making myself clear. Many thanks in advance. Insure that the Analysis ToolPak has been loaded. If your data is linear, then use LINEST() to derive the formula -- Gary's Student "rmellison" wrote: > If I have a set of data, is there any way I can generate a formula wh...

Getting All Data In Field To Load At Once...
I have a combo box that has approx. 9,000 records that it is querying... Sometimes when I select it, they are all loaded and I can scroll up and down through them with no problem. However, most of the time when it loads, not all the names have loaded, and I have to hold my mouse button down on the page down area of the scroll bar, in order to keep it loading. Is there a command I can put on the form load that will query or load all these records before the combo box is selected!? 9,000 is a lot of rows for a combo. I would split it alphabetically. I don't have any code handy but in th...

Cell formatting when importing data
When I import data from a delimited file into Excel 2000, even though I have pre-formatted a column as text, entries such as 12-5 and 1-4 -- which are not dates display as dates. When I reapply the text formatting I get a number: 38691. How can I get 12-5 to display as is when I bring the data in? Rename the file to *.txt and use the text import wizard, just click next twice and in step 3 select text from column data format for this particular column and click finish -- Regards, Peo Sjoblom "cjay" <cjay@discussions.microsoft.com> wrote in message news:90AAB750-BF9F...

Automatic transfer of user inputted data between sheets
Hi, I have just started using excel and have made my first real spreadsheet with 12 separate sheets. I have managed to automatically transfer results between sheets but I want to go up a level. My idea is to allow the user to input a name in one sheet and for this data to be automatically recognised in a separate sheet and automatically updated. Example : sheet 1 is the result sheet sheet 2 contains 15 "heat results" allowing the user to input points that are automatically added together and displayed both in sheet 1 and sheet 2. Now the hard part: After the 15 he...

Populating data from other sheets
Hello all, I would really appreciate some help with this project I a developing... I have 2 sheets in a workbook. Sheet 1 contains an assortment o information. Column A contains a string. I would like to highlight a selection of rows on Sheet 1. Then, fo each row in the selection, I would like the macro to compare th contents of the cell in Column A to the contents of each cell in Colum A on Sheet 2. If it finds a match in this column on Sheet 2, the macr should copy the contents of the cell in Column B to the matched-ro column B on Sheet 1. i.e. Sheet 1 Bob Mark John Sheet 2 Bob bso Jo...

Write data to a specific Excelsheet and cell from PPT
I'm making a test in PPT where some data needs to be written to a given cell in an Excel Worksheet. Example: I've got a page with 3 pictures. When you click on Img1, it should write "a" to a cell in an Excel sheet. When you click on Img2, it should write "b" to that same cell. When you click on Img3, it should write "c" to that same cell. After clicking, it should go to the next page, where it should write to a different cell in the same Excel document. It would be great if the Excel document is running in the background or better, if it isn&...

When entering data into excel spreadsheet cell, the page just jump
I am trying to add data to an existing worksheet this morning. I can click on the clel, but when I try to enter the data, the worksheet "jumps", am unable to enter any data. What have I done wrong? If you are making entries using the numeric keypad, it sounds like you turned your Num Lock off. Try pressing NUM LOCK (there should be alight that comes on above it when you do) & try again. HTH|:>) "jodj" wrote: > I am trying to add data to an existing worksheet this morning. I can click > on the clel, but when I try to enter the data, the worksheet &qu...

how to add an outlook email to a text box in an access form?
Hi, I searched everywhere for a similar issue but in vain... I have a form used to enter computer issues. I would like to add to it a text box that will store emails. It could be a button that opens a link to the email. I hope this is clear. thanks. Ismail -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200803/1 Hello, Could you save the emails in a folder and place a button on your form that is hyperlinked to the folder? Might be an easier way but this is pretty simple. "ielmrani via AccessMonster.com" wrote: > ...

If No Records in Subform, Parent Form Record doesn't display
If I don't have any records in a subform, the record in the parent form doesn't display on my main form. The record is in the underlying table for the parent form, so I don't understand what the problem is. I'm sure the solution is simple and I'll kick myself later. Thanks for the help! -- Thanks. "Melissa" <Melissa@discussions.microsoft.com> wrote in message news:21CC91F1-D0EF-4ECF-9CBB-D5B19CB684D8@microsoft.com... > If I don't have any records in a subform, the record in the parent form > doesn't display on my main form. ...

Using wildcard characters in find & replace
How do I change a range of Formula linked to 3 other files ? Example: Cell Reference: A7:='[AAA.xls]Sheet1'!A7+'[BBB.xls]Sheet1'!A7+'[BBB.xls]Sheet1'!A7 A8:='[AAA.xls]Sheet1'!A8+'[BBB.xls]Sheet1'!A8+'[BBB.xls]Sheet1'!A8 Want to change one of the references to '[BBB.xls] to '[CCC.xls] using wildcard characters but * and ? does not seam to be regognized in find and repalce ? They are recognized, but you may not be applying them correctly. Also, if you search for a wildcard, you'd have to define what to replace that ...

compare data #2
Hi everybody , maybe somebody can help me I need compare two collumn in excel / numbers / f.e: A B 11111 11111 11112 11113 11115 11115 05755 05755 02356 02356 I need get results for exsamle :numbers in collumn C , which is in both collumn / A,B / maybe it is posiible to give another result in collumn D - numbers which are only in collumn A and in collumn E numbers which are only in collumn B Thanks a lot for help. Qokino This seems so easy and so trivial. Just subtract Col A from Col B if the answer is zero print column A (or ...

Take Rows from Sheet1 and use as headers on Sheet2
I have 10 rows on sheet 1 that users fill in. I'd like those 10 rows to be the top lines printed on all subsequent sheets. Is this possible? How? Thanks in advance. Does "Sheets" mean pieces of paper -- when you print one worksheet, you can have multiple sheets of paper printed? If yes, then File|page setup|sheet tab|rows to repeat at top. If you mean you want worksheet 2 to use worksheet 1's headers, I think you'll want to put those headers in each worksheet. Keith Marbach wrote: > > I have 10 rows on sheet 1 that users fill in. I'd like those 10 ro...

Populate a comboxbox and Listbox in a excel userform with an sql table data
Hi All, I have a excel userform which has some combo boxes and list boxes and I want to populate this boxes with the data which I have on my sql server database tables. Just to give an example. My first combo box is for region which needs to be populated from a sql table called Region_Mapping and my first list box should be linked to the same sql table but it should populate the countries on the basis of the region which user will select in the combo box. For eg : In my sql table I have following countries which are mapped against America 1) Argentina 2) Brazil 3) Mexico 4) Canada...

move folders in outlook using vba
hi all, im trying to work out how to move folders using vba, i have manged to move emails to new folders but cant move folders we use public folders at work and the one i have to drag and drop to is buried some 10 levels down for the odd move this is no problem but at times i could be doing 20-30 my problems are how do you identify the current folder and then how do you move it this is what i have so far myfolder being the one im trying to move objfolder being the destination im playing with this on my personal pc hence the required path is not so long Sub folderm...

find rows for unique data in 1 column and different data in other.
I have a spreadsheet that contains 1 column that contains cells that may contain the same information such as A2 and A4 and A6 all contain 4144638872 - in columns B-P there may be information that may be different for each 1234 cell: A2=4144638872 B2=278954 A4=4144638872 B4=195871 A6=4144638872 B6=238521 I want to return a result of unique rows based on only 1 phone # that exists in column A. I need the information in column B and other columns and I don't care which of the 3 remain in the result sheet. Basically I have a list of file#s with the same phone #s and I only want ...

Chart using Macro
I have several sheets having similar data for different lanes. I have a macro which can create a graph I want with different series plotted in different forms for source data on a particular sheet. I want to be able to create a graph for the active sheet. How do I use ActiveSheet data as source data for the gaph. ...

CRM without using Exchange
Hi, I would like to find out whether it is possible for me to install MS CRM without Exchange component. What are the functions that I will not get? I prefer using Outlook to do E-mailing instead. Please advice -- -------------------------------------------- ReadySpace Network Pte Ltd www.readyspace.com Exchange 2000/2003 is optional for MSCRM v1.2. If not using Exchange, the feature you won't get is not able to send/receive email within MSCRM. You can use the Sales for Outlook client to manually promote emails into a MSCRM activity Frank Lee Workopia, Inc. http://www.workopi...

Classes for displaying waveform data?
I am searching for classes that can intelligently display waveform data based on zoom factor , window size, scale etc. Has anyone seen something like that? I have displays running now which look ok but they need to more intelligently handle zooming and such. Thanks Elan Would this sort of thing work for you: http://www.pablosoftwaresolutions.com/html/wave_editor.html Tom "Elan Magavi" <Elan@nomailnospam.com> wrote in message news:ybQqh.26886$QU1.15802@newssvr22.news.prodigy.net... >I am searching for classes that can intelligently display waveform data >base...

How to make a chart with selective (discontinuous) data?
For example, two colums A and B have 10 rows (2 to 11) with values in each cell. How can I make a graph A Vs B which displays data only from rows 2, 5 8 and 10. I mean from discontinuous data and not from a continuous range. If yes how to do in very large sheet? Best to use your worksheet to pull the data into a continuous range, and then plot that. -- David Biddulph "Making grapg from discontinuous data" <Making grapg from discontinuous data@discussions.microsoft.com> wrote in message news:6E74492E-4B84-41B1-B50A-C322A703370E@microsoft.com... > For example, two colu...