Feroz Khan

Feroz Khan

  • 1.4k
  • 300
  • 93.8k

How can i update DataGrid view value from another form textbox value

Feb 2 2023 1:16 PM

Dear All, 

Please need your support i am trying to update datagriviwe from another form textbox but cannot please need your support.

Below for you refrence.

private void btntupdate_modify_Click(object sender, EventArgs e)
{
    try
    {
        POS form1 = new POS();
        DataGridView Main_dg = (DataGridView)form1.Controls["dataGridView1"];
        for (int i = 0; i < Main_dg.Rows.Count; i++)
        {
            Main_dg.Rows[i].Cells[2].Value = txtupdate_grampcs.Text;
            Main_dg.Rows[i].Cells[3].Value = txtupdate_unitprice.Text;
            Main_dg.Rows[i].Cells[4].Value = txtupdate_total.Text;
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}
C#

Answers (2)

1
Nilesh Shah

Nilesh Shah

  • 13
  • 54.3k
  • 1.3m
May 31 2017 1:41 PM
If you are sure you will need 100+ areas, then it's better to use separate projects.
 
Even Microsoft suggests that.
 
I think the following link may help:
https://forums.asp.net/t/1834134.aspx?Areas+as+Separated+Projects+
https://msdn.microsoft.com/en-us/library/ee307987(VS.100).aspx
 
 
please mark my answer as accepted if it fulfils your questions. 
Accepted Answer
1
Nilesh Shah

Nilesh Shah

  • 13
  • 54.3k
  • 1.3m
May 31 2017 1:26 PM
I have worked on a big MVC project which has at least 35 areas to represent different modules. But there was not problem at all.
 
I think if it worked for 35, then it may work for 50 or 100 as well.
 
If you want to have multiple MVC projects then also it will create problem in URL redirection, etc. because that project is your entry point.
1
Nilesh Shah

Nilesh Shah

  • 13
  • 54.3k
  • 1.3m
May 31 2017 11:50 AM
as far as MVC is concerned, I suggest to keep different modules in areas.
 
the seggregation should not be at user requirement level, but it should be at technical level
 
you can further make different projects according to different business logics
0
Saravanan V

Saravanan V

  • 0
  • 997
  • 353.5k
May 31 2017 3:36 PM

Thanks for your update.

I have also figured out the MSDN link and was trying to execute the walkthrough steps.

I have gone through till the step "Adding Area-Enabled Link to the Logon User Control" and having problem at the step "Enabling the Custom Build Step for MVC Areas Projects" as couldn't able to find the lines as per the walkthrough.  
 
Anyways, thanks for your valuable inputs and time.
0
Saravanan V

Saravanan V

  • 0
  • 997
  • 353.5k
May 31 2017 1:33 PM

Ok. We are sure that we are going to hit the number 100 going forward.

The article what I had seen online tells about keeping the respective Area code files as separate project and create .bat file to copy the view files from each project to the main web project during the build and it was not satisfactory to me considering the build and deployment process.

0
Saravanan V

Saravanan V

  • 0
  • 997
  • 353.5k
May 31 2017 1:18 PM

Hi Nilesh,
Thanks for your kind response.

Actually, client is a technical person and also the final authority on approving the technical stuff. 
Each module is different from the other for sure and what is being tried out is to reuse the same authentication, branding etc., for all of the modules.
 
As per the suggestion, let's say modules are being added under Areas in the web project. Going forward, when there we encounter a situation to have 50 or 100 modules, would it be good to continue as such?
 
Do we have any drawbacks on this approach when we have huge number of modules under Areas?
What would be the key decision factor to finalize the approach?
 
Thanks,
Saravanan