|
I need some guidance in making project setup .I have some steps which presently i am performing one by one. Like intsalling Mysql,Making it a window service. then installing the front end for mysql. running script file for database. making a dsn and then finally installing the project. I want all these things to be done by code as i am doing evrything manuaaly now. I am using innosetup for project setup.moreover i need to check whether .net framework and mysql is already installed or not. Can anyone guide me pls.
Thanks
Monica
|
|
|
|
|
I have the following two functions. My goal is to highlight a row in a
datagrid and delete a row. Problem arises when I click on the delete button.
Below are two sub routines for DoDelete. Which route should I go with?
I have created stored procedure for deleting the row as well.
Any help would be greatful.
Private Sub highLightRow(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim pt = New Point(e.X, e.Y)
Dim grd As DataGrid = CType(sender, DataGrid)
Dim hit As DataGrid.HitTestInfo = grd.HitTest(pt)
If hit.Type = grd.HitTestType.Cell Then
grd.CurrentCell = New DataGridCell(hit.Row, hit.Column)
RowNum = hit.Row
grd.Select(RowNum)
PolicyNumber = Convert.ToString(grd.Item(RowNum, 1))
TransCodeOrig = Convert.ToString(grd.Item(RowNum, 2))
TransEffDate = Convert.ToString(grd.Item(RowNum, 3))
ModifiedUID = Convert.ToString(grd.Item(RowNum, 7))
End If
End Sub
Public Sub DoDelete()
Dim bm As BindingManagerBase = Me.DataGrid1.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember)
Dim dr As DataRow = CType(bm.Current, DataRowView).Row
Try
PolicyNumber = dr(1)
TransCodeOrig = dr(2)
TransEffDate = dr(3)
ModifiedUID = dr(7)
dr.Delete()
DsTransOverride1.dbo_stp_SelTransOverrides.Clear()
SqlDataAdapter1.Fill(DsTransOverride1.dbo_stp_SelTransOverrides)
' SqlDataAdapter1.Update(Me.DsTransOverride1, "dbo_stp_SelTransOverrides")
DsTransOverride1.dbo_stp_SelTransOverrides.AcceptChanges()
Me.lbNumRec.Text = Me.DsTransOverride1.Tables(0).Rows.Count.ToString()
Catch exError As Exception
MessageBox.Show(exError.Message)
End Try
End Sub
Public Sub doDelete()
' MDI Main Delete record requ3est toolbar button pressed
'if no records are displayed on the grid exist then exit
Dim ConnectionString As String = System.Configuration.ConfigurationSettings.AppSettings("FinSolMainDBConn")
Dim connfinsol As New System.Data.SqlClient.SqlConnection(ConnectionString)
Dim myCommand As New SqlCommand("stp_DelTransOverride ", connfinsol)
myCommand.CommandType = CommandType.StoredProcedure
'Add Parameters
' 1 Policy Number
myCommand.Parameters.Add("@Policy_Nbr", SqlDbType.VarChar, 7).Value = PolicyNumber
' 2 Original Tranaction Override
myCommand.Parameters.Add("@Trans_CodeOrig", SqlDbType.VarChar, 6).Value = TransCodeOrig
' 3 Transaction Effective Date
myCommand.Parameters.Add("@Trans_Eff_Date", SqlDbType.DateTime, 8).Value = TransEffDate
' 8 Modified UID
myCommand.Parameters.Add("@ModifiedUID", SqlDbType.NVarChar, 48).Value = ModifiedUID
'Open Connection
Try
'Open Connection
connfinsol.Open()
myCommand.ExecuteNonQuery()
MsgBox("Data Deleted Successfully !", MsgBoxStyle.Information, Me.Text)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Me.Text)
Finally
If myCommand.Connection.State = ConnectionState.Open Then
myCommand.Connection.Close()
End If
End Try
End Sub
I am not sure where to go, which DoDelete do go with.
Any help would be appreciated.
|
|
|
|
|
ok i hope this helps.
<asp:datagrid id="dgResults" runat="server" width="100%" autogeneratecolumns="False" ondeletecommand="dgResults_Delete" datakeyfield="form_id">
<alternatingitemstyle backcolor="#C0C0FF">
<itemstyle backcolor="#8080FF">
<headerstyle backcolor="Gainsboro">
<columns>
<asp:boundcolumn datafield="form_id" headertext="Form ID"><headerstyle width="65px">
<asp:boundcolumn datafield="hazard" headertext="Hazard Name">
<asp:boundcolumn datafield="description" headertext="Hazard Description">
<asp:buttoncolumn text="Delete Form" buttontype="LinkButton" commandname="delete">
<headerstyle width="80px">
this is the datagrid that i used in a recent project add this or something similar to the html.Make sure to add the onDeleteCommand & DataKeyField(this is the id of a column in your database).
then add the following to the code behind page.
Sub dgResults_Delete(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
Dim Selectedform_id As String = dgResults.DataKeys(E.Item.ItemIndex)
conn.Open()
Try
Dim command As New SqlCommand("DeleteForm", conn)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("@form_id", dgResults.DataKeys(E.Item.ItemIndex))
command.Parameters.Add("@form_id", dgResults.DataKeys(E.Item.ItemIndex))
Finally
conn.Close
End Try
''write statement to rebind the datgrid once deleted. Also notice that i used a stored procedure to delete the details in the database.
Hope this is helpful if not give me another shout.
gfhg
|
|
|
|
|
Gah help, I'm going crazy. Yet another one of those late night programming sessions to meet a deadline.
And I'm stuck on the silliest of silly bugs.
A small piece of code to insert an error message into a table.
The stored procedure:
CREATE PROCEDURE dbo.sp_ServiceLog <br />
@Description nchar(100)<br />
AS<br />
INSERT INTO ServiceLog (dtstamp,Description)<br />
VALUES<br />
(GetDate(), @Description)<br />
GO
The vb code to insert it:
Dim c As New OdbcCommand("sp_ServiceLog", cnn)<br />
c.CommandType = Data.CommandType.StoredProcedure<br />
Dim p1 As New OdbcParameter("@Description", OdbcType.NChar, 100)<br />
p1.Value = _message<br />
c.Parameters.Add(p1)
But everytime its run, the following error appears:
ServiceLog Insert: ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure 'sp_ServiceLog' expects parameter '@Description', which was not supplied.
Can anyone spot the mistake?
plzzzzzzzz
|
|
|
|
|
I have created an application which on connecting to outlook iterates through the mapifolders and pulls messages out of the store. On various occasions the outlook object will fail to connect to an Outlook folder, this failure then caches and reconnecting to this folder requires Outlook.exe to be restarted. Tighter object handling and setting folder objects to Nothing minimises this but I have been unable to remove it entirely. Different connection modes also minimises this, however the connection mode is a read-only property and I am unable to set it at the application level. Any suggestions?
|
|
|
|
|
I am trying to dynamically change the size of a form at run time. I am finding that if I change it to say 1400, it actually resets the height to a height of 1212. Does anyone know why I might be seeing this type of magic?
|
|
|
|
|
What code are you using to set the size of the form, then read back the size? It sounds like your setting the height of the entire form to 1400, then just looking at the heigh of its client area.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am simply settingteh height based on a configuration. The actual code is something liek this:
frmLot.DefInstance.Height = (lblslots(1).Height * Rows) + + (id(1).Height * Rows) + (600) ' / hf)
If I do the math with an instant watch it comes up to 1400. When I execute the line and look at the height it shows 1212 even though the formula works out to 1400 in the instant watch window. In my watch window I can change it to anything under 1212.
|
|
|
|
|
How do you hide a tabPage within a tabcontrol?
There is no visible property in the tabPage properties
-- modified at 15:01 Wednesday 7th September, 2005
|
|
|
|
|
You can't. (Microsoft control design is pretty stupid sometimes).
There are several workarounds. If you don't mind the tabpage itself still being visible, you can either set all the controls on the tabpage to invisible, or better still, put all the controls on a tabpage on a Panel and set the Panel to invisible.
If you want tab pages to be visible or not visible, what you can do is store a copy of ecxah tab page in a form level collection. Then you can delete the tab page from the Tab Control's TabPages collection, and later restore it from a copy you saved in the form level collection.
|
|
|
|
|
I cannot see the property visible for tabpages within tabcontrol?
Or what is the syntax to make a tabpage invisible or visible.
|
|
|
|
|
There is no property of this type for a tab page.
Take the suggestion of saving a copy of the tabpage somewhere then delete it from the tabcontol.
'Save a copy
Dim tp As TabPage
tp = TabControl1.TabPages(0)
'Delete the tab page
TabControl1.TabPages.Remove(TabControl1.TabPages(0))
'Add the tab page
TabControl1.TabPages.Add(tp)
the problem with this is that when the tab page is deleted and/or added, the order of the tabs becomes out of original order.
|
|
|
|
|
KaptinKrunch wrote:
the problem with this is that when the tab page is deleted and/or added, the order of the tabs becomes out of original order.
Yes. I advise caching all of the original tabpages in a form level collection. This way when you need to restore any particular TabPage what you can do is simply call the Clear method of the TabControl.TabPages collection to remove all the tabpages. The enumerate the collection, adding each copy of the original tabpages back to the TabControl.TabPages collection. This will restore the original tabpages in their original order.
|
|
|
|
|
I have the code.....
Dim myDataView As DataView
Dim dt As DataTable
dt = League.Tables(0)
myDataView = dt.DefaultView
myDataView.Sort. = "Points"
But when it sorts the points, it does it in reverse. Lowest to highest instead of highest to lowest.
E.G. Instead of
0 8
2 6
3 3
6 2
8 0
|
|
|
|
|
|
I have a fixed size dataset which I need users to be able to update, but not add new records.
so I need to be able to disable inserting/adding rows in datagrids in VB.Net without turning off updating.
The only way I have found to disable updating in any way is the set the datagrid readonly property to true.
Any suggestions will be welcomed
Tim Emjay
Small Systems Developer
|
|
|
|
|
Setting readonly=true is the best solution since you don want to update the datagrid....You can update the dataset anytime
_mubashir
|
|
|
|
|
I do want to be able to update the datagrid, I want to stop the addition of rows in the datagrid.
Tim Emjay
Small Systems Developer
|
|
|
|
|
Can you display text box values in one form that was entered in another form rather than assign them as global variables. If so how is this done?
Example
Form1
TextBox1 = 3
Form2
TextBox1 = Form1.textbox1.text
|
|
|
|
|
Your on the right track.
'Form1
Textbox1.text = "TEST"
'Create new instance of form 2
Dim frm as new Form2
'Assign the textbox properties
frm.Textbox1.Text = Textbox1.text
'Show the form
frm.ShowDialog
|
|
|
|
|
Hi,
I´m new in the forum and in VB.NET and i have a few doubts. I want to do and aplicattion which should get documents from a folder and show them in a form as a link but i don´t now how to do that. If any of you should now how to do that i´ll apreciate it.
Thanks for all,
Rincito
|
|
|
|
|
Code to get files from directory.
Function GetMyFiles(byval directory as string) as string()
Dim theFiles() as string
theFiles = System.IO.Directory.GetFiles(directory)
return theFiles
End Function
Code to add link to form.
Sub AddALink(ByVal name As String, ByVal x As Integer, ByVal y As Integer)
Dim aLink As New LinkLabel
aLink.Text = name
Dim thisSpot As New Point(x, y)
aLink.Location = thisSpot
Me.Controls.Add(aLink)
End Sub
Code to Make it all work
Sub RunIt()
Dim s As String
Dim x As Integer = 5
Dim y As Integer = 10
For Each s In GetMyFiles("C:\")
AddALink(s, x, y)
y += 25
Next
End Sub
The only problem left that maybe someone else can answer is how to wire up all of the click events. As of this point the links are added to the form, but if you click one, nothing happens of course.
|
|
|
|
|
Thanks,
I´m going to try it as soon as possible.
R
|
|
|
|
|
I am an developer and use SharpDevelop and OpenOffice.org Base for database purpose. Can i connect an OpenOffice database to an sharpdevelop project, so i can begin the programming. How i do programming an simple database with an datagrid in sharpdevelop?
|
|
|
|
|
I dont know anything about open office but i do use sharp develop quite a bit. Its pretty much the same as VS2003 but missing some of the wizards. It has exactly the same designer support for the datagrid and any code that works in VS will work in SD. You can use any of the samples here on CP or anywhere else and load them straight into SD. The main difference is SD uses 'Combines' instead of VS's 'Soloutions'. Just go to file and Import in SD to import a VS soloution into SD then use as normal.
Jon
|
|
|
|