cancel
Showing results for 
Search instead for 
Did you mean: 

static refer to non-static

Former Member
0 Kudos

In the wdDoModify () the method is static

public static void wdDoModify(){

checkTable();

}

public void checkTable(){

wdContext.currentContext.getEmpid();

}

ERROR : The method checkTable() is not static

after that i change to

public static void checkTable(){

wdContext.currentContext.getEmpid();

}

Error: cannot make static field to non-static field wdContext

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Just pass parameter "wdContext" from method wdDoModifyView() to the static method:

public static void wdDoModifyView(...)
{
   ...
   checkTable(wdContext, ...);
}

private static void checkTable(IPrivate<View>.IContextNode wdContext, ...)
{
}

Armin

Former Member
0 Kudos

HI,

From wdDomodify(),it is not possible.

Declaring a new method using standard control is also of same purpose.

So, create a new method and paste the code from the method inside

//@@begin others

//@@ end

Static method can access only static variables.U r getting the error because wdContext is a nonstatic variable and the static method u created inside

//@@begin others

//@@ end

is accessing that nonstatic variable(wdContext).

Regards

Fahad Hamsa

Former Member
0 Kudos

HI,

Create method using new button in the method tab. Let the method name be test().

U can access this method from wdDomodifyView() by

wdThis.test()

Regards

Fahad Hamsa

Former Member
0 Kudos

if i want to access the method in

//@@begin others

//@@ end