Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i wanted to make a dll for a function with multiple parameters
in that one parameter is for name of datagridview
if i pass the name in string it shows that datasource could not be assigned to string
adp = New SqlDataAdapter("select CId,SrNo,Date,Name,Contact,Contact1,ResNumber,DOB,Age,Location,Qualification,CurrentOrganizatn,WorkExp,CalledBy,EQId,SentTo,HRStatus,Process,SentTo1,HRStatus1,Process1,SentTo2,HRStatus2,Process2,SentTo3,HRStatus3,Process3,SentTo4,HRStatus4,Process4,Remark,Remark1 from TotTab where convert(datetime,Date,105) between convert(datetime,'" + DispatchFrom + "',105) and convert(datetime,'" + DispatchTo + "',105) and SentTo='" + offerCb + "'   and HRStatus like 'rej%', con)


in other case if i want to use that dataset as datasource on other project it shows that dataset not defined

Private Sub DispatchBtn_Click(sender As System.Object, e As System.EventArgs) Handles DispatchBtn.Click

       Dim Hi As New dispatched.Class1
       Hi.selectDispatch(offerCb.Text, DispatchFrom.Text, DispatchTo.Text, My.Settings.Equation1ConnectionString)
       DispatchGrid.DataSource = Hi.ds1.Tables(0)
  
End Sub



how can i pass it can some 1 help me..
Posted

1 solution

You can not access dataset like Hi.ds1. instead return dataset from DLL and assign it in another object which is defined on page.

You can't pass gridview to .dll directly. you need to import namespace of System.Windows.Forms.
don't pass gridview to dll. pass dataset instead.
 
Share this answer
 
Comments
Acharya Vikram 16-Dec-11 4:58am    
in dll should i write

return (ds1) or some thing else
and how will i use it in another application
Acharya Vikram 16-Dec-11 5:15am    
can U help me a bit more by just putting an example..
I want to show the returned dataset into gridview

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900