|
Mbire wrote: How then does MySQL know the database i am interested in or how can i make it known without having to enter the credentials every time i open the connection?
You will need to specify the database name. http://www.connectionstrings.com[^] has many different database connection strings that you might find helpful.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
What is there to elaborate? The value of the townId is in the ComboBox's SelectedValue property. That's the value that you update the Person's record with.
Where's the problem?
|
|
|
|
|
Helo dear!
I want to install two projects and two third party softwares with one setup programme. want to start one project wait to complete then start another but fails. please help me.
I will be grateful
Julian
|
|
|
|
|
I have an mdb file that has vb code in my PC. I want other users to use it from their PCs'. But a copy the file should not work on their PCs'. I can not check it with any hardware ids' because each instance would run diffent h/w ids in different PCs'. What else is left for me as options?
|
|
|
|
|
you can split you're mdb file into a front-end and a back-end
front-end would have linked tables and forms and everything else
back-end would have only tables
an other option is terminal server (if you have the funds for it) but then you have the problem of locking and still need the front-end and back-end solution
an other option is just put a shortcut to the mdb on the netwerk on every pc but once again problem with locking can occure here
as to restricting the users from copying the file that's probably going to require permisions settings on the OS (not shure about it since I haven't tryed it)
hope this helps
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
Thank you TD. I want the file residing only in on machine and I have it ready. Now I want it to be accessible from any PC in the n/w. But that file should be coded in such a way that it will work only in my PC. A copy of the file should not work in any other PC. But others could access my copy over the n/w. While a person access it remotely the new instance should generate an ID specific to my PC. But Hardware IDs' are generated on the PC's h/w that access it so i can not use those.
If I could detect all the pc's in the n/w by hostname or IP that also would help. So that I can track whether the access is through n/w or is it a direct access.
Thank you once again.
|
|
|
|
|
tonymathewt wrote: If I could detect all the pc's in the n/w by hostname or IP that also would help
I wouldn't exactly know how to do what you want but I can give you the .net code to detect all pc's in the n/w (at least by tommorow I can normally get it) but I don't think it wil work in access
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
How to retreive the Application path. For eg. d:\MyApp\ is the main dir. which contains sub dirs like Templates, bin etc.
<br />
My.Application.Info.DirectoryPath Gives me d:\MyApp\bin\Debug
I want is just d:\MyApp. I don't want to hard code it as user may have different path. Any idea, how to retreive it.
Thanks
Terry
|
|
|
|
|
My.Application.Info.DirectoryPath gives you the path of the application folder. When you are running the code from Visual Studio, you get a path like "d:\MyApp\bin\Debug". This is the application path, and if you try to get outside this folder, it won't work when you deploy the application.
If you have files in your project that you want in the application folder, show the properties for the file, and change the "Copy To Output Directory" property from "Do not copy" to "Copy if newer".
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks Guffa,
I want to access MyApp\Templates dir while run time. It contains files in it. The TEmplates folder is not added into the project.
So how do i end up retreving it in the app. at run time. Is ther any other way to get path of MyApp? Should I copy the Templates folder into the Debug folder? Can you please give me a direction to achieve the goal. I am using VS 2005.
Thanks
Trupti
Thanks
Terry
|
|
|
|
|
Trupti Mehta wrote: I want to access MyApp\Templates dir while run time.
No, you don't. That path will not exist if you deploy the application without including the files in the application folder.
Trupti Mehta wrote: The TEmplates folder is not added into the project.
That is the problem. Follow my instructions in my previous post.
Trupti Mehta wrote: Should I copy the Templates folder into the Debug folder?
That's done automatically when you mark the files to be included in the application.
Trupti Mehta wrote: Can you please give me a direction to achieve the goal.
I already did. If there is something that you don't understand about it, you have to say so.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks. I got the solution.
My.Computer.FileSystem.GetParentPath(My.Computer.FileSystem.GetParentPath(My.Application.Info.DirectoryPath())) + "\Templates\"
This takes me to MyApp, & then I set to Templates dir.
Thanks
Terry
|
|
|
|
|
Trupti Mehta wrote: Thanks. I got the solution.
No, you didn't. You missed the entire point of my previous post.
If you go outside the application folder, as you just did, the code will not work when you deploy it.
Change the properties for the files that you want included in the application, just as I explained in my previous post.
---
single minded; short sighted; long gone;
|
|
|
|
|
Oh Thanks, Guffa.
As you mentioned, I added the Templates folder in the Project - "Inclided in the Project". But on Properties on the Tempaltes Folder, I can't find anything like Copy.... Their is just Folder name proeprty. The Files in it has such property. If I update those properties for all files in the Template dir., then when user adds new files (Programmatically), how can the property be set for that newly created file by the user.
Thanks
Terry
|
|
|
|
|
Trupti Mehta wrote: then when user adds new files (Programmatically), how can the property be set for that newly created file by the user
Do you recompile the application whenever a user adds files to the folder?
---
single minded; short sighted; long gone;
|
|
|
|
|
No. I was just saying that for the folder "Templates", their is only Folder Name property. I have included in the package, now how do i access it.
While Deploying, I created a Setup package, I have added "Templates" folder in the "Application...". I tried adding the Templates folder itself, but wasn't able to add it. So did this way. Did i do rgt or no! If no, can you tell what to do.
Thanks
Terry
|
|
|
|
|
Hi all
I have created crystal reports in vb.net using SQLEXPRESS database. I have now converted the SQLEXPRESS database to a normal SQL SERver database. This new database has all the same tables and table names but the database name is different (Cannot be changed). I have changed the database source for the reports via Datbase expert but when running the report it still gives the error that it cannot find the datasource and references the old database name.
Can anyone please tell me how to fix this error or where to change the reference to the old database?
Dazz
|
|
|
|
|
Where is the data source/connection string being stored?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Dear you are really special to me and you have made good experience in vb.net windows application. I am a beginner. I have a problem to update Database Record from in my Windows application. Hope you may help me.
My source table has more than one column have primary key (composite primary key) if I have only one Column set as Primary Key I can update and Delete Database Record.
But My Database table using 4 columns as Primary Key how to validate the primary key while checking the record is exist? In Where condition?
I write the code below. Pleas help me to solve my small Problem and you will be appreciated.
Thanking you.
Private Sub Cmd_Save_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Cmd_Save.Click
Dim sql As String
sql = " Select * From ICECREAM_TRANSACTIONS order by Ice_Seq"
Dim Adp_1 As New OleDb.OleDbDataAdapter(sql, Cn_Def)
If Status Then
If Trim(Me.Comb_IDMASTER.Text) <> Nothing AndAlso IsNumeric(Me.Comb_IDMASTER.Text) Then
If Trim(Me.Cmb_Fish_Code.Text) <> Nothing AndAlso IsNumeric(Me.Cmb_ice_Code.Text) Then
If Trim(Me.DTP_icecream_DATMASTER.Text) <> Nothing AndAlso IsDate(Me.DTP_icecream_DATMASTER.Text) Then
If Trim(Me.CMB_MKT_CODEMASTER.Text) <> Nothing AndAlso IsNumeric(Me.CMB_MKT_CODEMASTER.Text) Then
If Not Found_Prim("ICECREAM_TRANSACTIONS", "ICE_SEQ", " & Val(Me.Comb_IDMASTER.Text) & " And "ICE_CODE", "& Val(Me.Cmb_Ice_Code.Text) & " And "ICETRN_DAT", "Me.DTP_ICETRN_DATMASTER.Text" And "MKT_CODE", "& Val(Me.CMB_MKT_CODEMASTER.Text)&") Then
CMDS.Exec(Cn_Def, "Insert into ICECREAM_TRANSACTIONS(Ice_Seq,Ice_Code,ICETRN_DAT,MKT_CODE,QTY,WHOLSALE_PRICE,RETAIL_PRICE,NATURE,EXPORT,IMPORT) Values(?,?,?,?,?,?,?,?,?,?)", _
New Object() {Val(Me.Comb_IDMASTER.Text), Val(Me.Cmb_Ice_Code.Text), Me.DTP_ICETRN_DATMASTER.Text, Val(Me.CMB_MKT_CODEMASTER.Text), Val(Me.Txt_QTY.Text), Val(Me.Txt_WHOLSALE_PRICE.Text), Val(Me.Txt_RETAIL_PRICE.Text), Me.TXT_NATURE.Text, Me.CHK_EXPORT.Checked, Me.CHK_IMPORTED.Checked})
MsgBox("New Record Added into the Database " & vbCrLf & "___________" & vbCrLf & vbCrLf & "Insert a New Record", MsgBoxStyle.Information, Me.Text)
Clear_Txt()
Else
CMDS.Exec(Cn_Def, "Update ICE_TRANSACTIONS set ICE_SEQ=?,ICE_CODE=?,ICETRN_DAT=?,MKT_CODE=?,QTY=?,WHOLESALE_PRICE=?,RETAIL_PRICE=?,TOTAL_PRICE=?,NATURE=?,EXPORT=?,IMPORT=? Where ICE_SEQ=" & Me.Comb_ICE_SEQ.Text& "AND ICE_CODE = " & Me.Cmb_Ice_Code.Text &" AND ICETRN_DAT= "& Me.DTP_ICETRN_DAT.Text &" AND MKT_CODE = "& Me.CMB_MKT_CODEMASTER.Tex&" 'New Object() {Me.Comb_ICE_SEQ.Text, Me.Cmb_ICE_Code.Text, Me.DTP_ICETRN_DAT.Text, Me.Txt_MKT_CODE.Text, Val(Me.Txt_QTY.Text), Val(Me.Txt_WHOLSALE_PRICE.Text), Val(Me.Txt_RETAIL_PRICE.Text), Me.TXT_NATURE.Text, Me.CHK_EXPORT.Checked, Me.CHK_IMPORTED.Checked})
Cmd_Cancle_Click(sender, e)
End If
End If
End If
End If
End If
Else
End Sub
Rameel Rahim India
|
|
|
|
|
I got the class CalendarColumn which create DateTimePicker cell in GridView from MSDN.
I try to modify this class to allow user choose ShowCheckBox in DateTimePicker or not but I am fail.
Please help me the way to add this property which allow user choose to display CheckBox in DateTimePicker or not.
Thanks so much!
This is the class CalendarColumn :
Imports System
Imports System.Windows.Forms
Public Class CalendarColumn
Inherits DataGridViewColumn
Public Sub New()
MyBase.New(New CalendarCell())
End Sub
Public Overrides Property CellTemplate() As DataGridViewCell
Get
Return MyBase.CellTemplate
End Get
Set(ByVal value As DataGridViewCell)
' Ensure that the cell used for the template is a CalendarCell.
If (value IsNot Nothing) AndAlso _
Not value.GetType().IsAssignableFrom(GetType(CalendarCell)) _
Then
Throw New InvalidCastException("Must be a CalendarCell")
End If
MyBase.CellTemplate = value
End Set
End Property
End Class
Public Class CalendarCell
Inherits DataGridViewTextBoxCell
Public Sub New()
' Use the short date format.
Me.Style.Format = "d"
End Sub
Public Overrides Sub InitializeEditingControl(ByVal rowIndex As Integer, _
ByVal initialFormattedValue As Object, _
ByVal dataGridViewCellStyle As DataGridViewCellStyle)
' Set the value of the editing control to the current cell value.
MyBase.InitializeEditingControl(rowIndex, initialFormattedValue, _
dataGridViewCellStyle)
Dim ctl As CalendarEditingControl = _
CType(DataGridView.EditingControl, CalendarEditingControl)
ctl.Value = CType(Me.Value, DateTime)
End Sub
Public Overrides ReadOnly Property EditType() As Type
Get
' Return the type of the editing contol that CalendarCell uses.
Return GetType(CalendarEditingControl)
End Get
End Property
Public Overrides ReadOnly Property ValueType() As Type
Get
' Return the type of the value that CalendarCell contains.
Return GetType(DateTime)
End Get
End Property
Public Overrides ReadOnly Property DefaultNewRowValue() As Object
Get
' Use the current date and time as the default value.
Return DateTime.Now
End Get
End Property
End Class
Class CalendarEditingControl
Inherits DateTimePicker
Implements IDataGridViewEditingControl
Private dataGridViewControl As DataGridView
Private valueIsChanged As Boolean = False
Private rowIndexNum As Integer
Public Sub New()
Me.Format = DateTimePickerFormat.Short
End Sub
Public Property EditingControlFormattedValue() As Object _
Implements IDataGridViewEditingControl.EditingControlFormattedValue
Get
Return Me.Value.ToShortDateString()
End Get
Set(ByVal value As Object)
If TypeOf value Is String Then
Me.Value = DateTime.Parse(CStr(value))
End If
End Set
End Property
Public Function GetEditingControlFormattedValue(ByVal context _
As DataGridViewDataErrorContexts) As Object _
Implements IDataGridViewEditingControl.GetEditingControlFormattedValue
Return Me.Value.ToShortDateString()
End Function
Public Sub ApplyCellStyleToEditingControl(ByVal dataGridViewCellStyle As _
DataGridViewCellStyle) _
Implements IDataGridViewEditingControl.ApplyCellStyleToEditingControl
Me.Font = dataGridViewCellStyle.Font
Me.CalendarForeColor = dataGridViewCellStyle.ForeColor
Me.CalendarMonthBackground = dataGridViewCellStyle.BackColor
End Sub
Public Property EditingControlRowIndex() As Integer _
Implements IDataGridViewEditingControl.EditingControlRowIndex
Get
Return rowIndexNum
End Get
Set(ByVal value As Integer)
rowIndexNum = value
End Set
End Property
Public Function EditingControlWantsInputKey(ByVal key As Keys, _
ByVal dataGridViewWantsInputKey As Boolean) As Boolean _
Implements IDataGridViewEditingControl.EditingControlWantsInputKey
' Let the DateTimePicker handle the keys listed.
Select Case key And Keys.KeyCode
Case Keys.Left, Keys.Up, Keys.Down, Keys.Right, _
Keys.Home, Keys.End, Keys.PageDown, Keys.PageUp
Return True
Case Else
Return False
End Select
End Function
Public Sub PrepareEditingControlForEdit(ByVal selectAll As Boolean) _
Implements IDataGridViewEditingControl.PrepareEditingControlForEdit
' No preparation needs to be done.
End Sub
Public ReadOnly Property RepositionEditingControlOnValueChange() _
As Boolean Implements _
IDataGridViewEditingControl.RepositionEditingControlOnValueChange
Get
Return False
End Get
End Property
Public Property EditingControlDataGridView() As DataGridView _
Implements IDataGridViewEditingControl.EditingControlDataGridView
Get
Return dataGridViewControl
End Get
Set(ByVal value As DataGridView)
dataGridViewControl = value
End Set
End Property
Public Property EditingControlValueChanged() As Boolean _
Implements IDataGridViewEditingControl.EditingControlValueChanged
Get
Return valueIsChanged
End Get
Set(ByVal value As Boolean)
valueIsChanged = value
End Set
End Property
Public ReadOnly Property EditingControlCursor() As Cursor _
Implements IDataGridViewEditingControl.EditingPanelCursor
Get
Return MyBase.Cursor
End Get
End Property
Protected Overrides Sub OnValueChanged(ByVal eventargs As EventArgs)
' Notify the DataGridView that the contents of the cell have changed.
valueIsChanged = True
Me.EditingControlDataGridView.NotifyCurrentCellDirty(True)
MyBase.OnValueChanged(eventargs)
End Sub
End Class
Public Class Form1
Inherits Form
Private dataGridView1 As New DataGridView()
<stathreadattribute()> _
Public Shared Sub Main()
Application.Run(New Form1())
End Sub
Public Sub New()
Me.dataGridView1.Dock = DockStyle.Fill
Me.Controls.Add(Me.dataGridView1)
Me.Text = "DataGridView calendar column demo"
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) _
Handles Me.Load
Dim col As New CalendarColumn()
'I wish the code : col.ShowCheckBox = true / false here
Me.dataGridView1.Columns.Add(col)
Me.dataGridView1.RowCount = 5
Dim row As DataGridViewRow
For Each row In Me.dataGridView1.Rows
row.Cells(0).Value = DateTime.Now
Next row
End Sub
End Class
|
|
|
|
|
u will take the dll of datetime picker
put the datagridview1 in the toolbox and drop in the form
right click of addcolumn then there are three field (1)Name (2) Type (3) header text
in name write the column name , type select the type of dll ,write the name of the header
|
|
|
|
|
Thanks rohitsrivastava !
I think that is a solution.
I will test for this.
But how about coding to modify the class.
Best regards,
pvphuc
|
|
|
|
|
My VB 6 MDI project isn't closing right. When I hit the red X, it doesn't terminate, and when compiled, it doesn't close the program when you hit the X. What am I missing? Is there a quick way to close all windows and processes associated with a project and make sure everything is terminated properly?
Thanks for your help.
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
The best way to terminate your program is to catch Form Closing event & if button click. In Form Closing, add the following lines:
<object instances=""> = nothing
Me.Dispose()
GC.Collect()
Make sure that you make all of the objects created as Nothing, and then call Me.Dispose. For eg.,
Dim myDataGrid as DataGrid
Dim obj as Object
....
in Form Closing
myDataGrid = Nothing
obj = Nothing
This will make all the objects used as Null & free up all the memory. To remove all such object permanently, it is recommended to use GC.Collect(). GC frees all vars. as Nothing or not used from the memory. This is an Object Oriented concept.
Hope this helps.
Thanks
Terry
|
|
|
|
|
Thanks for your help, but I need the answer for VB6. Does it work the same way?
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|