Forum guidelines
  • Home
  • »
  • .NET General
  • »
  • How to pass project_id from one form to another form in vb.
AuthorQuestion
How to pass project_id from one form to another form in vb.
Posted on: 21 Aug 2013
How to pass project_id from one form to another form in vb.
AuthorReply
Re: How to pass project_id from one form to another form in vb.
Posted on: 21 Aug 2013  
Assuming the project_id doesn't change, I'd assign it to a Friend field of the start-up form:

Public Class Form1

    Friend Project_Id As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Project_Id = 42 ' or whatever
    End Sub

End Class

You can then access it from any other form in the project with the expression:

   Form1.Project_Id
 

Re: How to pass project_id from one form to another form in vb.
Posted on: 21 Aug 2013  
hi,

I have little idea about VB but in this case you can pass project id by constructor or public property of another form.

for example I have 2 forms form1 and form2 and i want to pass project id from form1 to from2

1)
public Form2(int projectId)
{
}

in from1

Form2 f2 =new Form2(projectId);
f2.Show();

2) pass project id through property

public class form2
{
        public int ProjectId {get;set;}
}

Form2 f2 =new Form2();
f2.ProjectId =projectId;
f2.Show();


hope this will help you.

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.