我创建了一个.ini
文件。我正在编写.ini
中的ini_class
文件的编程。我想知道VB.NET中的一件事。
当找不到文件时,我在读取模式下需要一个例外。我在MSDN上搜索过,我找不到任何东西。
这在VB.NET中是否可行?
答案 0 :(得分:1)
您可以使用Throw
创建例外。
当找不到文件时,我需要关于读取模式的例外。
您应该使用FileNotFoundException
。
Throw New FileNotFoundException
另请查看each constructor。 您可以在此处设置自定义消息:
Throw New FileNotFoundException("Could not open the stream: file not found.")