请帮我这个错误引用非共享成员需要一个对象引用 [英] Please help me with this error reference to non-shared member requires an object reference

查看:69
本文介绍了请帮我这个错误引用非共享成员需要一个对象引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub Admissionrecord_Load(sender As Object, e As EventArgs) Handles MyBase.Load
	'TODO: This line of code loads data into the 'ButhdatabaseDataSet.Admission' table. You can move, or remove it, as needed.
	OpenConnection()
	Dim da As OleDbDataAdapter
	Dim dt As DataTable
	da = New OleDbDataAdapter("SELECT Hospital No,Patient's Name,Date Attended,Reffered By,Consultant,Ward,Date Discharged,Discharged To,Condition On Discharge,Discharge Summary FROM Admission", Connection)
	dt = New DataTable
	da.Fill(dt)
	AdmissionDataGridView.DataSource = dt
	AdmissionDataGridView.Refresh()
	Connection.Close()
	da.Dispose()

	SaveFileDialog.FileName = ""
	SaveFileDialog.Filter = "PDF (*.pdf) |*.pdf"

	Me.AdmissionTableAdapter.Fill(Me.ButhdatabaseDataSet.Admission)

End Sub





我尝试了什么:



i试图添加对我的项目的引用但仍然是同样的,请帮助我



What I have tried:

i have tried to add a reference to my project but yet is still the same, kindly help me

推荐答案

SaveFileDialog是一个类:要使用它你需要创建一个类的实例,你不能只是尝试访问非-shared属性:

SaveFileDialog is a class: to use it you need to create an instance of the class, you can't just try and access non-shared properties:
SaveFileDialog.FileName = ""
SaveFileDialog.Filter = "PDF (*.pdf) |*.pdf"

你需要 - 在某个地方,你不要在那个方法中使用它,所以你用它做什么并不明显 - 创建一个类的实例,这样你就可以显示它:

You need to - somewhere, you don't use it in that method, so it's not obvious what you do with it - create an instance of the class so you can display it:

Dim mySaveFileDialog as SaveFileDialog = New SaveFileDialog


这篇关于请帮我这个错误引用非共享成员需要一个对象引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆