|
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
|
|
|
|
|
I believe it will work. 99% GC line wont work. Stil, I m not sure. Check out. If it gives error, remove it & try. Rest all remains the same.
Thanks
Terry
|
|
|
|
|
The MDI form's QueryUnload method probably has something that prevents your form from closing...
|
|
|
|
|
For anyone else having this problem, I found this article very helpful:
http://vbcity.com/forums/topic.asp?tid=99480[^]
The problem was, I wasn't unloading the child forms last. I was running code after the unload was called. The code reloaded them, and then the parent form ended with them still in memory. Close the child forms last.
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
Hi to all!!
I need a major project in visual basic...kindly help me out!!!
|
|
|
|
|
so you're looking for an idea for a major project, is that what you mean, how bout some specifics:
what did you already have in mind,?
what does it need to cover, topics etc?
what are you must comfortable with out of those topics?
|
|
|
|
|
Seriously, how is anyone supposed to answer this question?
There's is nothing here on what you know, the size of your team, if any, if there is any goal in doing to the project, what you intend to learn, industries your interested in, other projects you've done.
You've given us nothing to go on.
So, I can suggest a few. A control system for a nuclear power plant. Maybe a flight control system for an airliner. Engine and power management for the worlds largest container ships.
Those are all major projects...
|
|
|
|
|
Hello,
How can we recover deleted files in any format like .doc, .txt, .mdb from hard disk.
If anybody knows, please give URL or sample code.
Thanks & Regards,
Kumar
|
|
|
|
|
There's lots of stuff out there.
If you want to write your own, there is no URL I can give you. You must simplely know, and have experience with, file systems, especially NTFS and FAT, like you know the back of your hand.
|
|
|
|
|
Hi Dave Kreskowiak,
Thanks a lot for giving hint.
Thanks & Regards,
Kumar
|
|
|
|
|
Hi, I have written a simple program to better understand the concept of variable scope and I'd like your help in explaining a few things. My program simulates a ticketmaster, using a bunch of buttons to represent the number of available seats to a show. Every time a customer clicks on a button, its color turns from gray to blue. One seat will be subtracted from the total number of available seats when each button is clicked. I have created a global integer variable TotalSeats which represents the total number of seats available. The following code snippets are for the button which represents the first seat, and for the SHOW button to show the total number of available seats.
<br />
Dim TotalCount As Integer = 30<br />
<br />
Private Sub Seat1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Seat1.Click<br />
Dim A As Integer = 0<br />
While A < 1<br />
Seat1.BackColor = System.Drawing.Color.Blue<br />
A += 1<br />
TotalCount -= 1<br />
<br />
End While<br />
End Sub<br />
<br />
Private Sub SHOW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SHOW.Click<br />
<br />
Label1.Text = TotalCount<br />
End Sub
Please answer the following 2 questions, thank you in advance for your help.
1) I thought that TotalCount is a global variable and even though its being used in a private Sub, its should still be visible to the SHOW button, why does Label1 show that TotalCount is 30 and not 29?
2) How do I group all the seat buttons together so that I can use just one requiredvalidator for all of them?
|
|
|
|
|