2012-07-19 5 views
1

가능한 중복은 :
How to access the object itself in With … End With내가 일하는 "With"항목을 참조 할 수있는 방법이 있습니까?

내가 이런 일을 하시겠습니까 가정하자 : 기본적으로

With grid.Columns("Reviewed") 
     CType(<the with object>, DataGridViewCheckBoxColumn).ThreeState = False 
     ... 
End With 

을, 나는에 다음의 동등하고 싶습니다 위 성명서 :

CType(grid.Columns("Reviewed"), DataGridViewCheckBoxColumn).ThreeState = False 

"WITH"라는 개체를 참조 할 때 사용할 수있는 키워드가 있습니까?

+4

이 게시물을보십시오. http://stackoverflow.com/questions/1152983/how-to-access-the-object-itself-in-with-end-with – PaShKa

답변

2

내 지식에 따라 정확하게 할 수있는 방법은 없지만 어떤 일을하는지에 따라 다른 변수를 만들어 해당 열을 참조하는 것이 더 쉽습니다.

Dim ReviewColumn as DataGridViewCheckBoxColumn = grid.Columns("Reviewed") 
With ReviewColumn 
    .ThreeState = False 
    ''etc     
End With 

는 솔직히 난 그 시점에서 블록으로 사용하지 것이다.

관련 문제