+ 1
Access data in datagridview from a class
I'm trying to pass values from datagridview to a list. And then in a new class I want to make som methods accessing that list. Trouble is that when I pass the datagridview it returns it without content and values which means I can't do anything with it. any help is appreciated! see more information on link. http://stackoverflow.com/questions/42026708/access-data-in-datagridview-from-a-class/42026887?noredirect=1#comment71228293_42026887
10 Respostas
0
I don't remember the full path, but Globalization in System might be able to help. it should allow you to access other files in your code from there
0
Are you sure this is a step in the right direction? From msdn documentation it seems that system.globalization contains classes for different regions, calendars etc.
0
wait no, I'm wrong. add the form to the namespace. should be accessable then.
0
the class and form see in the same namespace.
0
they're both in the same name space? and you can't make an object for the class?
0
they're both in the same namespace and I can't access values from datagridview (public partial class form1) from another class. let's say class MyClass.
0
oh yeah, no. I'm pretty sure all its methods are protected. I don't think windows wants you editing the form dynamically.
0
I probably found the solution here: https://social.msdn.microsoft.com/Forums/windows/en-US/a5e3b46e-8d45-4c45-a3d6-20a25b746825/accessing-form1-controls-from-a-different-class?forum=winforms I tried something similar at work today which worked for a simpler project I wrote to test, but that solution didn't functioned properly in my real project. I'll find out tomorrow an will let you know how it went.
0
thanks. I'm curious.
0
I can confirm that my last post was the solution. Great workday today 😁