1 Replies - 2847 Views - Last Post: 21 November 2013 - 04:26 AM Rate Topic: -----

#1 vishal anand   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 28-August 13

calling method/function from mdi parent form in child form

Posted 21 November 2013 - 02:49 AM

hi my name is vishal. i am going through transition from vb6 to c#.
my question is how to call method/function from mdi parent form in child form?
i have browsed through net but nothing seems to work. i have a method in mdi parent form, but i do not know how to call that method in child form as i am a novice to c#. can anyone help me please?
any help would be of assistance.
my mdi parent form name: MDIParent1
my child form name: Patient
my mdi method/function name: updateUserActivities(long refID,int ActType,string ActivityStr)

 public string updateUserActivities(long refID, int ActType, string ActivityStr)
        {
      
            SqlDataAdapter da = new SqlDataAdapter();
            int b;
            da.InsertCommand = new SqlCommand("Insert into user_activities2(user_id,row_upd_date,activity,type,ref_id)" + "Values(@user_id,@row_upd_date,@activity,@type,@ref_id)", conn);
            da.InsertCommand.Parameters.Add("@user_id", SqlDbType.VarChar).Value = pUserID;
            da.InsertCommand.Parameters.Add("@row_upd_date", SqlDbType.DateTime).Value = Convert.ToDateTime(this);
            da.InsertCommand.Parameters.Add("@activity", SqlDbType.VarChar).Value = ActivityStr;
            da.InsertCommand.Parameters.Add("@type", SqlDbType.Int).Value = ActType;
            da.InsertCommand.Parameters.Add("@ref_id", SqlDbType.VarChar).Value = refID;
            b = da.InsertCommand.ExecuteNonQuery();
            conn.Close();
            return updateUserActivities(refID, ActType, ActivityStr);
        }



Is This A Good Question/Topic? 0
  • +

Replies To: calling method/function from mdi parent form in child form

#2 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2523
  • View blog
  • Posts: 10,101
  • Joined: 03-December 12

Re: calling method/function from mdi parent form in child form

Posted 21 November 2013 - 04:26 AM

Reference the parent form.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1