vb.net对话框操作实例(一)

 时间:2024-10-12 14:08:26

Creating a message box using different buttons and iconsCreating an Open dialog that enables you to open filesCreating a Save dialog that enables you to save filesCreating a Font dialog that enables you to apply the selected font to textCreating a Color dialog that enables you to define and select custom colorsCreating a Print dialog that prints text from your applicationCreating a Browse dialog that enables you to browse for folders

工具/原料

visual studio 2015

​Creating a message box using different buttons and icons

1、Private Sub btn2Buttons_Click(sender As Object,e As EventArgs) Handles btn2Buttons.ClickIf MessageBox.Show("Your Internet connection will now be closed.", "Network Notification", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) _ = Windows.Forms.DialogResult.OK Then lblResults.Text = "OK Clicked" 'Call some method hereElse lblResults.Text = "Cancel Clicked" 'Call some method hereEnd IfEnd Sub

vb.net对话框操作实例(一)

THE OPENFILEDIALOG CONTROL

1、Public Class Dialogs 'Declare variable Private strFileName As StringPrivate Sub btnOpen_Click(sender As Object, e As EventArgs) Handles btnOpen.Click 'Set the Open dialog properties OpenFileDialog1.Filter = "Text Documents (*.txt)|*.txt|All Files (*.*)|*.*" OpenFileDialog1.FilterIndex = 1 OpenFileDialog1.Title = "Demo Open File Dialog" 'Show the Open dialog if the user clicks the Open button, 'load the file If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Try 'Save the file path and name strFileName = OpenFileDialog1.FileName Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End IfEnd Sub

vb.net对话框操作实例(一)
  • unity 如何实时获取麦克风的音量
  • 孤岛惊魂6DLC什么时候上线
  • CST微波工作室仿真怎样选择求解器
  • 剑灵散播和阻止谣言的人任务怎么做?
  • Edge浏览器如何删除全部网站的Cookie及数据?
  • 热门搜索
    手游英雄联盟怎么下载 生蚝怎么保存 玫瑰花茶怎么泡 电脑桌面壁纸怎么换 许褚怎么读 怎么挽回女朋友 怎么看手机型号 脚垫怎么治 怎么查询社保卡余额 怎么保护牙齿