Visual C# 2013逆引き大全 555の極意

基本プログラミングの極意 - Tips195 ユーザー名/コンピューター名を取得する

Icon comment count 0
Icon stock count 0

Tips195ユーザー名/コンピューター名を取得する

Pointシステム情報の取得(SystemInformationクラス、UserNameプロパティ、ComputerNameプロパティ)

Level1
対応
  • EXP
  • PRO

ユーザー名を取得するには、System
InformationクラスのUserNameプロパティを使います。

SystemInformation.UserName

また、コンピューター名を取得するには、SystemInformationクラスのComputerNameプロパティを使います。

SystemInformation.ComputerName

リスト1では、ボタンをクリックされたら、ユーザー名とコンピューター名をラベルに表示しています。

出典情報

Medium

Visual C# 2013逆引き大全 555の極意

  • 著者: 増田智明、池谷京子、国本温子

コメント

    コメントはありません