Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2009, 04:07 PM
Registered User
 
Join Date: May 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Form to Form Communications

Here's my (simple?) VB 2005 problem:

I need to update a NumericUpDown control on FormA from FormB

I've tried running this from frmB:

MySolution.frmA.nud1.Value = intNewValue

I've also tried creating the following subroutine on frmA:

Friend Sub UpdateNud(ByVal intNewValue As Integer)
Me.nud1.Value = intNewValue
End Sub

Both options run without complaint but neither changes the value. I've searched through stacks of literature but haven't yet found a solution. Any help would be appreciated.
 
Old May 20th, 2009, 12:02 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Have you tried cross-posting from form B to form A?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old May 20th, 2009, 12:24 PM
Registered User
 
Join Date: May 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Form to Form Communications

Sorry, I'm not sure what that means so I guess the answer must be no.

Regards,
Pete
 
Old May 20th, 2009, 01:31 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Form A markup:

Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FormA.aspx.cs"
   Inherits="FormA" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
   TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <title>Form A</title>
</head>
<body>
   <form id="form1" runat="server">
      <div>
         <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />
         <asp:TextBox ID="TextBox1A" runat="server" />
         <cc1:NumericUpDownExtender ID="TextBox1_NumericUpDownExtender"
            runat="server" Enabled="True" Maximum="1.7976931348623157E+308"
            Minimum="0" TargetControlID="TextBox1A" Width="100">
         </cc1:NumericUpDownExtender>
      </div>
   </form>
</body>
</html>
Form A code-behind:

Code:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class FormA : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       if (PreviousPage != null)
       {
          TextBox1A.Text = ((TextBox) PreviousPage.FindControl("TextBox1B")).Text;
       }
    }
}
Form B markup:

Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FormB.aspx.cs"
   Inherits="FormB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <title>Form B</title>
</head>
<body>
   <form id="form1" runat="server">
      <div>
         <p>
            Put an integer in the textbox below, and click the button to
            cross-post it to Form A.
         </p>
         <asp:TextBox ID="TextBox1B" runat="server" />
         <asp:Button ID="Button1" runat="server" Text="Post" PostBackUrl="FormA.aspx" />
      </div>
   </form>
</body>
</html>
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
pjtraynor (May 20th, 2009)
 
Old May 20th, 2009, 01:45 PM
Registered User
 
Join Date: May 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Form to Form Communications

That's very helpful - Thanks!





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set a form as startup form in vb.net 2.0 mallikalapati .NET Framework 2.0 1 February 21st, 2008 09:19 AM
Close all MdiChield form from open one form/Button salman .NET Framework 2.0 6 December 10th, 2007 03:21 AM
Firefox Error when Form Floated / Form locks socoolbrewster CSS Cascading Style Sheets 5 October 6th, 2007 09:59 PM
Converting an HTML Form to ASP.Net Form k_alidxb75 ASP.NET 1.x and 2.0 Application Design 0 November 30th, 2006 03:26 AM
parent form from child form - urgent plz netfresher C# 1 November 8th, 2006 06:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.