|
If I set the Topmost Property to false, then for any event happening like displaying message box or opening any other form, this Find form gets minimised and loses it's focus.
Can we display FindForm after closing the messageBox?
|
|
|
|
|
It's either the Owner or Parent property. You need to set one of these for all child windows, and then they can never go behind their owner.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi guys,
i have got a vb6 application and i need to incorporate globalisation(multi-language support), i know its easy in vb.net with the Culture class, so how do i create a DLL from VB.NET that is referenceable from VB6
|
|
|
|
|
i have a code that points to one line, i have used my error trap, to trap it and it gave me an Error, that i dont see where it points to,here is the code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strconnection As String = "workstation id=5875-049;packet size=4096;user id=sde;Password=topology;data source=SGIICORNETGS01;persist security info=False;initial catalog=Tshwane_Valuations"
Dim cn As SqlConnection = New SqlConnection(strconnection)
cn.Open()
'set up data adapter
Dim strSql As String = _
"select Boundary_Area,Actual_Extent," _
& "Attrib_code,Lis_key,Func_key," _
& "Density,New_Net_Usable_Extent," _
& "New_Total_Land_Factor,New_AdJ_Extent_1," _
& "New_Points_1,New_ADJ_Extent_2," _
& "New_Points_2,Fin_Ls_Prediction," _
& "Confidence_score,Flagtype from Property_Mass"
Dim strErrorMsg As String
Dim strerror As System.Data.SqlClient.SqlError
Try
Dim da As SqlDataAdapter = New SqlDataAdapter(strSql, cn)
'Declare and load the Data set
Dim ds As DataSet = New DataSet
da.Fill(ds, "Property_Mass")
'set up data Adapter Object
strSql = _
"select Property_Mass.Boundary_Area,Property_Mass.Actual_Extent,Property_Mass.Attrib_code,Property_Mass.Lis_key,Property_Mass.Func_key,Property_Mass.Density," _
& "Property_Mass.New_Net_Usable_Extent,Property_Mass.New_Total_Land_Factor,Property_Mass.New_AdJ_Extent_1,Property_Mass.New_Points_1,Property_Mass.New_ADJ_Extent_2,Property_Mass.New_Points_2,Property_Mass.Fin_Ls_Prediction,Property_Mass.Confidence_score,Property_Mass.Flagtype,Property_Summary.Purchase_Date,Property_Summary.Purchase_Price" _
& "from(Property_Mass, Property_Summary)" _
& "where(Property_Mass.Lis_key = Property_Summary.Lis_key)"
da = New SqlDataAdapter(strSql, cn)
'load a Dataset
da.Fill(ds, "Property_Mass")
'Close the Connection
'cn.Close()
'Create relations
ds.Relations.Add("Property_summary_Mass", _
ds.Tables("Property_Mass").Columns("Lis_key"), _
ds.Tables("Property_Summary").Columns("Lis_key"))
'Bind the data set to the grid.
'Assumes that Grid contains a reference to a
'system.windows.datagrid
DataGrid2.SetDataBinding(ds, "Property_Mass")
'sorting the Datagrid
'DataGrid2.AllowSorting = True
Catch ExSQL As System.Data.SqlClient.SqlException
' '''All this will trap all data Problems and Network if available
For Each strerror In ExSQL.Errors
Next
Select Case strerror.Number
Case 17
strErrorMsg = "Missing server"
Case 4060
strErrorMsg = "Missing database"
Case 18456
strErrorMsg = "Missing user name or password"
Case Else
strErrorMsg = strerror.Message
End Select
MessageBox.Show(strErrorMsg, "SQL Server Error: " & strerror.Number, MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ExcpInvOp As System.InvalidOperationException
MessageBox.Show("Close the connection first!", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch Excp As System.Exception ' generic exception handler
MessageBox.Show(Excp.Message, "Unexpected Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub btnliskey_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnliskey.Click
'Open Database Connection
Dim strconnection As String = "workstation id=5875-049;packet size=4096; user id=###; Password=######; data source=########;persist security info=False;initial catalog=Tshwane_Valuations"
Dim cn As SqlConnection = New SqlConnection(strconnection)
cn.Open()
'set up data adapter
Dim strSql As String = _
"select Actual_Extent,Attrib_code,Lis_key,Func_key,Density," _
& "New_Net_Usable_Extent,New_Total_Land_Factor,New_AdJ_Extent_1,New_Points_1," _
& "New_ADJ_Extent_2, New_Points_2, LS_Prediction, LS_Confidence,LS_TYPE from Property_Mass "
Dim da As SqlDataAdapter = New SqlDataAdapter(strSql, cn)
' Load(DataSet)
Dim ds As DataSet = New DataSet
da.Fill(ds, "Property_Mass")
'Set up a new Data adapter Object
strSql = _
"select Property_Mass.Actual_Extent,Property_Mass.Attrib_code,Property_Mass.Lis_key,Property_Mass.Func_key,Property_Mass.Density," _
& " Property_Mass.New_Net_Usable_Extent,Property_Mass.New_Total_Land_Factor,Property_Mass.New_AdJ_Extent_1, Property_Mass.New_Points_1," _
& " Property_Mass.New_ADJ_Extent_2, Property_Mass.New_Points_2, Property_Mass.LS_Prediction, Property_Mass.LS_Confidence, Property_Mass.LS_TYPE," _
& " Property_Summary.Purchase_Date, Property_Summary.Purchase_Price" _
& " from Property_Mass, Property_Summary" _
& "where Substring(Lis_key,1,4) LIKE @Pattern"
da.SelectCommand.Parameters("Lis_key").Value = txtliskeysearch.Text
If ds.Tables("Property_Mass").Rows.Count = 0 Then
MessageBox.Show("Township not Found")
Else
da.Fill(ds)
End If
And this is the Error
The Column Prefix 'Property_Summary' does not match with the table name or Alias name used in this Query.
Thanks you
Vuyiswa Maseko
|
|
|
|
|
usually this error message means you made a typo in you're sql string
somwhere you access property_summary where he can't find it in the from clause
so check you're sql strings if they work (if needed try them out directly in you're db)
|
|
|
|
|
Thank you very much TDDragon , i have verfied with SQl , andf it told me there was a Problem and i fixed it, when it comes to my Relations, it tell me that the Object reference is not set. please Explain the Relation code to me. Thanks
'Create relations
ds.Relations.Add("Property_summary_Mass", _
ds.Tables("Property_Mass").Columns("Lis_key"), _
ds.Tables("Property_Summary").Columns("Lis_key"))
The code is even Available from the Previous code i have posted.
Thanks
Vuyiswa Maseko
|
|
|
|
|
my first thought would be that you'r ds doesn't contains the 2 tables or that 1 (or both) of the tables doesn't contain the column
but I can't be shure about that since I'v never made a datatable like this before
perhaps you should consider 'Christian Graus' his post and use a stored procedure (will work faster too)
|
|
|
|
|
Generating this SQL like this is nasty - you should put it in a stored proc, which you can then test against your database, independant of your code, and that should help you find where the problem is.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Vuyiswa,
I think problem is in the string SqlStr. Ur SqlStr is:
"select Property_Mass.Actual_Extent,Property_Mass.Attrib_code,Property_Mass.Lis_key,Property_Mass.Func_key,Property_Mass.Density," _
& " Property_Mass.New_Net_Usable_Extent,Property_Mass.New_Total_Land_Factor,Property_Mass.New_AdJ_Extent_1, Property_Mass.New_Points_1," _
& " Property_Mass.New_ADJ_Extent_2, Property_Mass.New_Points_2, Property_Mass.LS_Prediction, Property_Mass.LS_Confidence, Property_Mass.LS_TYPE," _
& " Property_Summary.Purchase_Date, Property_Summary.Purchase_Price" _
& " from Property_Mass, Property_Summary" _
& "where Substring(Lis_key,1,4) LIKE @Pattern"
da.SelectCommand.Parameters("Lis_key").Value = txtliskeysearch.Text
there is a small mistake in the query. you need a space between then table name "Property_Summary" and "Where" clause. Just make the chenges and ur code will work fine.
Regards,
Paramhans Dubey.
|
|
|
|
|
Hi ParamHans
Thank you very much for your reply, after i removed the spaces as you will see in the folloeing code, i still got the Error that says
Object reference not set to an Instance of an Object.
The Following is my code in my form load, i thought if you can see my code, you will understand where does the Error comes from. thanks once more time.
Dim strconnection As String = "workstation id=5875-049;packet size=4096;user id=****; Password=*****;data source= ********;persist security info=False;initial catalog=******_****"
Dim cn As SqlConnection = New SqlConnection(strconnection)
cn.Open()
'set up data adapter
Dim strSql As String = _
" select Boundary_Area,Actual_Extent," _
& "Attrib_code,Lis_key,Func_key," _
& "Density,New_Net_Usable_Extent," _
& "New_Total_Land_Factor,New_AdJ_Extent_1," _
& "New_Points_1,New_ADJ_Extent_2," _
& "New_Points_2,Fin_Ls_Prediction," _
& "Confidence_score,Flagtype from Property_Mass"
Dim da As SqlDataAdapter = New SqlDataAdapter(strSql, cn)
'Declare and load the Data set
Dim ds As DataSet = New DataSet
da.Fill(ds, "Property_Mass")
Dim strErrorMsg As String
Dim strerror As System.Data.SqlClient.SqlError
'set up data Adapter Object
strSql = " select Property_Mass.Boundary_Area," _
& " Property_Mass.Actual_Extent," _
& " Property_Mass.Attrib_code, Property_Mass.Lis_key," _
& " Property_Mass.Func_key, Property_Mass.Density," _
& " Property_Mass.New_Net_Usable_Extent," _
& " Property_Mass.New_Total_Land_Factor," _
& " Property_Mass.New_AdJ_Extent_1,Property_Mass.New_Points_1," _
& " Property_Mass.New_ADJ_Extent_2,Property_Mass.New_Points_2," _
& " Property_Mass.Fin_Ls_Prediction,Property_Mass.Confidence_score," _
& " Property_Mass.Flagtype,Property_Summary.Purchase_Date," _
& " Property_Summary.Purchase_Price" _
& " from Property_Mass , Property_Summary " _
& " where (Property_Mass.Lis_key = Property_Summary.Lis_key)"
da = New SqlDataAdapter(strSql, cn)
'load a Dataset
Try
da.Fill(ds, "Property_Mass")
'Close the Connection
cn.Close()
ds.Relations.Add("Property_summary_Mass", _
ds.Tables("Property_Mass").Columns("Lis_key"), _
ds.Tables("Property_Summary").Columns("Lis_key"))
'Bind the data set to the grid.
'Assumes that Grid contains a reference to a
'system.windows.datagrid
DataGrid2.SetDataBinding(ds, "Property_Mass")
'sorting the Datagrid
DataGrid2.AllowSorting = True
Catch ExSQL As System.Data.SqlClient.SqlException
'''All this will trap all data Problems and Network if available
For Each strerror In ExSQL.Errors
Next
Select Case strerror.Number
Case 17
strErrorMsg = "Missing server"
Case 4060
strErrorMsg = "Missing database"
Case 18456
strErrorMsg = "Missing user name or password"
Case Else
strErrorMsg = strerror.Message
End Select
MessageBox.Show(strErrorMsg, "SQL Server Error: " & strerror.Number, MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ExcpInvOp As System.InvalidOperationException
MessageBox.Show("Close the connection first!", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch Excp As System.Exception ' generic exception handler
MessageBox.Show(Excp.Message, "Unexpected Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Vuyiswa Maseko
|
|
|
|
|
do you know at wich line of code you'r error occurs
normally this error means you try to access a variable that hasn't been initialized yet (that is nothing or null)
perhaps debugging and looking at you'r variables to see if they contain any values will help clear this error
|
|
|
|
|
hi TDDrogon
Thanks very much and the other Guys, you helped me,my code is now working,the Proble was the issue in the "Primary keys of "Property_Summary" table
Thanks
Vuyiswa Maseko
|
|
|
|
|
Hi,
I am having a problem with updating my database with dataset changes!
I have separte DataAcessTier where i create all the dataset stuff using some CreateDataSet and bring it to presentationTier, that works fine, but when i try to update the changes, i again go back to dataccess tier for using UpdateDataSet Function, and there problem arises!
I dunno which DataAdapter is to be used for DataSet Update Now,
There is no error at all but the dataadaper's Fill method is not updating the stuff?
What to DO???
|
|
|
|
|
which com object should i use? and can somebody provide with a beginner level code in vb.net? plz help me!
|
|
|
|
|
There's a SAPI SDK you can download. It's not a trivial, beginner level thing.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
could someone help me with this problem
the error said Object reference not set to an instance of an object.
Dim dd As Array
Dim ee As Integer
Dim tt As String
ListBox1.Items.CopyTo(dd, ee) ''''error occurs here''''
tt = ee
TextBox1.Text = tt
|
|
|
|
|
Well, dd is null, and ee is 0. What did you expect ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
use 'new'
dim dd as new array
|
|
|
|
|
Hi
I have migrated the code that was previously in VB 6.0 to VB.NET (2.0)
The output is a dll.
A VB Script is accessing the VB dll using CreateObject() and the functions written in it are called.
Now with using the .NET dll the same does not work.
I tried registering it as COM visible and all of it.But I still get the error.
Thanks for the help
|
|
|
|
|
Did you create a COM dll, or just blithely try to register a dll that knows nothing abuot COM ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I created a COM visible dll by checking the option in Compile setting for Solution.
|
|
|
|
|
I need your helps regarding Context Menu in VB6.0
My Question
On Right Click some text in the text box on selecting menu items in context menu "string should be paste in the another text box"
Please let me know.my email nhsubash@gmail.com
Subash
|
|
|
|
|
i was making the setup of my applicatins .after i finished making the setup.and the deploying to the machine , which is not having the .net famework , there i got the following error.
i order to install the setup , i need to install the .net framework.
earlier i added the .net framework 2.0 , by right clicking the
setup - add - assembly -i browsed the framework from my hard disk.
Now my question is , the process i am executing is right?
or i need to rectify it somewhere?
is there anything i have to do in the poperties of setup - prerequisites -
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
You cannot add the framework to a setup, you can just tell it that the framework is required, and perhaps get it to download and install it. I write installers in C++ that run the framework install, then my MSI
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
suppose i have 100 clients and the database is centralized.then i will install the framework manually on each and every client.
It will become quiet tiresome?
that's y i asked , is there any provision to integrates the exe of the .net framework so that whenever the setup of my program executes , then it instals the setup without asking the dependency.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|