Click here to Skip to main content
15,920,669 members
Home / Discussions / C#
   

C#

 
GeneralRe: Background worker Pin
DaveyM6915-May-09 10:10
professionalDaveyM6915-May-09 10:10 
QuestionHow to prevent RowState change if Cell is not changed Pin
EURaklap15-May-09 6:19
EURaklap15-May-09 6:19 
QuestionMultiple forms and datagridviews Pin
bwood202015-May-09 6:02
bwood202015-May-09 6:02 
AnswerRe: Multiple forms and datagridviews Pin
Henry Minute15-May-09 10:05
Henry Minute15-May-09 10:05 
GeneralRe: Multiple forms and datagridviews Pin
bwood202015-May-09 10:09
bwood202015-May-09 10:09 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute15-May-09 10:33
Henry Minute15-May-09 10:33 
GeneralRe: Multiple forms and datagridviews Pin
bwood202015-May-09 12:17
bwood202015-May-09 12:17 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute15-May-09 13:09
Henry Minute15-May-09 13:09 
Lets try to sort this out one bit at a time.

In Form1 you have:
private DataSet Sds;
public DataSet GetDocs
{
get
{
return Sds;
}
set
{
Sds = value;
}


Then in Form2 there is:
object GD = GetForm1.GetDocs;


Since the GetDocs property in the first block above is the only public GetDocs on Form1, it must be that one that GD points to. The getter for GetDocs returns Sds. Now I cannot see anywhere on either form where Sds gets assigned to. I could well be wrong, however because of the way you have named the various members, it is very very difficult to follow what is happening.

It is recommended (in the Microsoft Style Guide for C#) that where there is a private field with a public accessor (your Sds and its property GetDocs, from the first code block above), the names should be the same but differentiated by case.

So can I suggest that you rename those to match that style. First, just to make it easier to work through please use Sds as the name for now, you can change it to whatever you want later.

1. Hover the mouse pointer over the Sds in the line private DataSet Sds;
2. Right-click
3. From the context menu, hover on 'Refactor' and from the sub-menu select 'Rename'
4. A Dialog will pop up with Sds in a textbox, change that to sds (all lower case) and click OK.
If all has gone well the code should look like this
private DataSet sds;
public DataSet GetDocs
{
get
{
    return sds;
}
set
{
    sds = value;
}


Repeat the above 4 steps for the GetDocs from the line public DataSet GetDocs and change it in the textbox to Sds and click OK.

Again if all has gone well you should have
private DataSet sds;
public DataSet Sds
{
get
{
    return sds;
}
set
{
    sds = value;
}


With any luck at all the Refactoring will have taken care of Form2 as well, and the line object GD = GetForm1.GetDocs; on Form2 will have become object GD = GetForm1.Sds;.

I am sorry if I have over simplified anything in this post, or explained something you already know how to do. I am not intending to be insulting, just trying to make sure we are on the same wavelength. Smile | :)

Come back when you are there.

Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

GeneralRe: Multiple forms and datagridviews [modified] Pin
bwood202018-May-09 6:50
bwood202018-May-09 6:50 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute18-May-09 8:18
Henry Minute18-May-09 8:18 
GeneralRe: Multiple forms and datagridviews Pin
bwood202018-May-09 8:44
bwood202018-May-09 8:44 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute18-May-09 9:54
Henry Minute18-May-09 9:54 
GeneralRe: Multiple forms and datagridviews Pin
bwood202018-May-09 12:54
bwood202018-May-09 12:54 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute18-May-09 13:01
Henry Minute18-May-09 13:01 
GeneralRe: Multiple forms and datagridviews Pin
bwood202019-May-09 7:13
bwood202019-May-09 7:13 
GeneralRe: Multiple forms and datagridviews [modified] Pin
Henry Minute19-May-09 8:33
Henry Minute19-May-09 8:33 
GeneralRe: Multiple forms and datagridviews Pin
bwood202019-May-09 9:22
bwood202019-May-09 9:22 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute19-May-09 10:52
Henry Minute19-May-09 10:52 
GeneralRe: Multiple forms and datagridviews Pin
bwood202019-May-09 12:36
bwood202019-May-09 12:36 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute19-May-09 13:48
Henry Minute19-May-09 13:48 
GeneralRe: Multiple forms and datagridviews Pin
bwood202020-May-09 10:02
bwood202020-May-09 10:02 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute20-May-09 10:14
Henry Minute20-May-09 10:14 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute20-May-09 10:19
Henry Minute20-May-09 10:19 
GeneralRe: Multiple forms and datagridviews Pin
bwood202021-May-09 6:25
bwood202021-May-09 6:25 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute21-May-09 7:01
Henry Minute21-May-09 7:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.