일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- @types
- JWT 토큰
- 메일수신거부처리
- nodejs
- ts7016
- 곧아빠됨
- 터미널옵션
- ChatGPT
- typesinstall
- 마이너스의 의미
- 패키지관리자
- 웹퍼블리셔종말
- 개발
- pnpm
- 하마모양
- 초보
- asp.net core
- c#
- TS70016
- .netcore
- 게시판
- locofy.ai
- 아들에게
- 메일수신거부 프로세스
- JWT 토큰 인증 로그인 쿠키 설정
- classNames
- 개발언어
- json pretty
- 웹퍼블리셔전망
- 스케쳐스아치핏
- Today
- Total
I am maker
C# winform 웹브라우져 폼 컨트롤 조작 본문
//셀렉트 박스 선택하기
HtmlElement searchForm = web_match.Document.GetElementById("form");
if (searchForm == null) return;
HtmlElementCollection selectElements = searchForm.GetElementsByTagName("select");
foreach (HtmlElement selectElement in selectElements)
{
switch (selectElement.Id)
{
case "select엘리먼트 id":
selectElement.SetAttribute("value", "1");//셀렉트 옵션 설정
selectElement.InvokeMember("onchange");//옵션 설정시 change이벤트 발생
break;
case "텍스트로선택할select_id":
for (int i = 0; i < selectElement.Children.Count; i++)
{
if (selectElement.Children[i].InnerText == "텍스트값")
{
selectElement.SetAttribute("selectedIndex", i.ToString());
break;
}
}
selectElement.InvokeMember("onchange");
break;
}
}
//인풋 데이터 넣기, 포커스주기
HtmlElement toFocusInputElement = null; //포커스 줄 엘리먼트
HtmlElementCollection inputElements = searchForm.GetElementsByTagName("input");
foreach (HtmlElement inputElement in inputElements)
{
switch (inputElement.Id)
{
case "인풋1":
inputElement.SetAttribute("value", "인풋값1");
break;
case "포커스인풋":
toFocusInputElement = inputElement;
break;
}
}
web_match.Focus();
toFocusInputElement.Focus();
'윈도우 Program. 윈폼, C#, VisualStudio로 구현. > 윈폼이 뭐죠?' 카테고리의 다른 글
메인에서 모든 예외 잡기 (0) | 2016.06.30 |
---|---|
Winform UserControl 속성 설정 (0) | 2016.06.30 |
윈폼 레이블 여러줄 멀티라인 (0) | 2016.06.30 |
윈폼 커스톰컨트롤 속성 디자인화면에서 설명보려면 (0) | 2016.06.03 |
윈폼이란? What is the Winform? (0) | 2016.03.31 |