将文件路径发送到其他表单上的文本框
在我的课堂上,我想将文件路径返回到其他形式的 tectbox 中,但保存后不会返回文件路径。可能因为它是一个子组件,不会返回值,我是否正确?但解决这个问题的正确方法是什么?
Friend Sub GetFilepath(ByVal hide As Boolean)
Dim GeluidS As New GeluidSchermForm
Call ExcelKoppelen("Z:\location\Geluidscherm_template.xls")
Filepath = Xl.GetSaveAsFilename("", "Excel document (*.xls), *.xls", , , )
Workbook.SaveAs(Filepath)
GeluidS.Excelfilenaam.Text = Filepath
End Sub
In my class i want to return the filepath into a tectbox on an other form, but it won't return the filepath after saving. Probally because it is a sub an't won't return a value am i correct? But what is the right way to fix this?
Friend Sub GetFilepath(ByVal hide As Boolean)
Dim GeluidS As New GeluidSchermForm
Call ExcelKoppelen("Z:\location\Geluidscherm_template.xls")
Filepath = Xl.GetSaveAsFilename("", "Excel document (*.xls), *.xls", , , )
Workbook.SaveAs(Filepath)
GeluidS.Excelfilenaam.Text = Filepath
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就这样吗?
Like that?
如果您提供的方法位于您想要获取文件名 FROM... 的表单中,
您可以创建一个返回全局变量的 ReadOoly 属性,并在表单被释放之前访问它。
另外,您可以编写一个函数来仅返回全局变量并在处理表单之前调用它。
根据
GetFilePath()
的使用方式,它可能无法工作。您必须从创建表单实例的表单外部调用它。仅凭方法很难说出它是如何使用的。If your provided method is within the form you want to grab the filename FROM...
You can create a ReadOoly property that returns a global variable and access it before the form is disposed.
Also, you can write a function to just return the global variable and call it before you dispose the form.
Depending on how
GetFilePath()
is used it may not work. You'd have to call it from outside the form, where the instance of the form was created. It's hard to tell how it's being used with just the method.