|
Have you tried setting it always on top?
David Loring
!! Keep Music Live !!
|
|
|
|
|
ya i have tryed
i need some code to be executed on a click event
now when the form lost its focus i need to click twice first to activate the form and the second to click on that button
and i need only to click once to activate the form as well as to click the button.
|
|
|
|
|
You may want to try setting the "ToolBox" form's TopLevel property to False, then add an instance of that form to the Controls collection of the main form.
|
|
|
|
|
set form2 property IsMdiContainer = true
then on form2 load procedure..
Dim newform As New Form1
Form1.MdiParent = Me
Form1.Show()
this will put form1 into form2 and make form2 show the whole time. Not sure if that answers your question or not.
|
|
|
|
|
Hello,
I am working on a windows application with MDI form. Here in FIND functionality, a find form displayed with Find button working on "Enter" key.
The Find form functionality is in a different dll. I am accessing that dll to display find form on existing MDIChild form containing the data.
While this form is open, any messagebox displayed from the Find form is displayed on top. but the messages that are appearing from the MDIChild form are sometimes appearing behind the Find form.
Even if I opened any other form, sometimes it is also appearing behind this Find form.
Please let me know how should I bring these messages/new forms on Top?
Thanks in Advance,
Nivedita
|
|
|
|
|
first of all plz tell wether u set the form's "topmost" property to true or false
|
|
|
|
|
It's in the "InitializeComponent".
|
|
|
|
|
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
|
|
|
|
|