本文介绍了失败的“Hello World”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 希望这是对我如何进行设置的简单疏忽,因为这是我第一次运行VB,因为只安装VS社区2017(详见下文)。我创建了一个空白应用程序(通用Windows),向MainPage添加了一个按钮,然后双击按钮来编辑事件处理代码。我的计划是显示一个简单的消息框,所以在新创建的子消息中,我开始输入"messagebox"。但当我到达"mes"时,Intellisense已经用完了想法并且 错误 BC30451 'mes'未声明。由于其保护级别,它可能无法访问。 在我的错误列表中弹出。 请告诉我这是什么简单... 谢谢 吉米 Microsoft Visual Studio社区2017 版本15.2(26430.4)发布 VisualStudio.15.Release / 15.2.0 + 26430.4 Microsoft .NET Framework 版本4.7.02046 解决方案 嗨吉米! 在通用Windows应用程序中,Messagebox是MessageDialog。 这是代码(VB.NET)你'需要: 导入Windows.UI.Popups 导入Windows.UI.Xaml 导入Windows.UI.Xaml .Controls Imports Windows.UI.Xaml.Navigation Imports SDKTemplate Partial Public NotInheritable Class CloseCommand Inherits SDKTemplate.Common.LayoutAwarePage '指针回来到主页面。如果你想在MainPage中调用方法,如'作为NotifyUser()私有rootPage As MainPage = MainPage.Current Public Sub New() Me.InitializeComponent() End Sub Private Async Sub CloseCommandLaunch_Click(sender As Object,e As RoutedEventArgs)'创建消息对话框并设置其内容和标题 Dim messageDialog = New MessageDialog("未找到互联网连接。") '添加按钮并设置回调 messageDialog.Commands.Add(New UICommand(" Try)再次","Sub(命令) rootPage.NotifyUser(""& command.Label&"'按钮已被选中。",_ NotifyType.StatusMessage) End Sub)) messageDialog.Commands.Add(New UICommand(" Close",Sub(command) rootPage.NotifyUser("''' &安培;命令.Label& "'按钮已被选中。",_ NotifyType.StatusMessage)结束子)) '设置默认调用的命令 messageDialog.DefaultCommandIndex = 0 '设置按下转义时调用的命令 messageDialog.CancelCommandIndex = 1 '显示消息对话框 Await messageDialog.ShowAsync End Sub End Class 您可以在这里找到更多信息: https://docs.microsoft.com/en-us/uwp/api /windows.ui.popups.messagedialog 希望它有用。 如果它对你有好处,你能否将这个答案标记为你的问题的答案? 在Twitter上关注我: https://twitter.com/NordineMhoumadi Hopefully this is a simple oversight in how I've set things up, because this is the first time I've run VB since just installing VS Community 2017 (per details below). I created a Blank App (Universal Windows), added a button to MainPage and double-clicked the button to edit the event handling code. My plan was to display a simple messagebox so in the newly created sub I began typing "messagebox" but by the time I got to "mes", Intellisense had run out of ideas and ErrorBC30451'mes' is not declared. It may be inaccessible due to its protection level.popped up in my error list. Please tell me it's something simple... ThanksJimmyMicrosoft Visual Studio Community 2017 Version 15.2 (26430.4) ReleaseVisualStudio.15.Release/15.2.0+26430.4Microsoft .NET FrameworkVersion 4.7.02046 解决方案 Hi Jimmy !In the Universal Windows application Messagebox is MessageDialog.Here is the code (VB.NET) you'll need : Imports Windows.UI.PopupsImports Windows.UI.XamlImports Windows.UI.Xaml.ControlsImports Windows.UI.Xaml.NavigationImports SDKTemplatePartial Public NotInheritable Class CloseCommand Inherits SDKTemplate.Common.LayoutAwarePage ' A pointer back to the main page. This is needed if you want to call methods in MainPage such ' as NotifyUser() Private rootPage As MainPage = MainPage.Current Public Sub New() Me.InitializeComponent() End Sub Private Async Sub CloseCommandLaunch_Click(sender As Object, e As RoutedEventArgs) ' Create the message dialog and set its content and title Dim messageDialog = New MessageDialog("No internet connection has been found.") ' Add buttons and set their callbacks messageDialog.Commands.Add(New UICommand("Try again", Sub(command) rootPage.NotifyUser("The '" & command.Label & "' button has been selected.", _ NotifyType.StatusMessage) End Sub)) messageDialog.Commands.Add(New UICommand("Close", Sub(command) rootPage.NotifyUser("The '" & command.Label & "' button has been selected.", _ NotifyType.StatusMessage) End Sub)) ' Set the command that will be invoked by default messageDialog.DefaultCommandIndex = 0 ' Set the command to be invoked when escape is pressed messageDialog.CancelCommandIndex = 1 ' Show the message dialog Await messageDialog.ShowAsync End SubEnd ClassYou'll find more informations here : https://docs.microsoft.com/en-us/uwp/api/windows.ui.popups.messagedialogHope it wil be useful.If it's good for you, can you mark this answer as answer of your question please?Follow me on twitter : https://twitter.com/NordineMhoumadi 这篇关于失败的“Hello World”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-21 07:16