|
Hi Guys. I'm working in VB6 and need some help with the monthview control
I want t like have only the dates of a certain day ie.e mondays, tuesdays etc to be enabled and selectable whlst the rest of the days reain unselectable. Any ideas on how to do this .
|
|
|
|
|
I couldn't find a way to limit the selection to weekdays in the default control. I have another idea: if the user selects something from the default control that is not a week day, prohibit that selection and prompt the user to enter another value.
|
|
|
|
|
I was wondering how you would make an application run in the background when minimized to the system tray. I just mean when you pull up the task manager i want it to be running in the process window not the Application window. If it is possible i would like the code for both 6.0 and .NET. Thank You
|
|
|
|
|
Run the "application" as a service and start another application that controls a NotifyIcon that can observe and control the service. There are numerous examples on CP and other places of how to write a service in .NET; for VB6, you might look at the Desaware NT Service Toolkit.
|
|
|
|
|
Sorry for the hasty response earlier -- here is another simpler solution: instead of minimizing the window, make set Visible to false and set ShowInTaskBar to false, as well. It won't show in the task manager (at least not in Win2K/XP) and it won't display in the task bar either.
|
|
|
|
|
this is my first post...
im kinda new to VS.net, so take it easy . i have only worked with the vb console apps to date.
i was just wondering if there is a way to make an array out of a property procedure? i mean, i declare my property procedure named Score, which is a variable to store a test score, as a percentage. I want to have 3 test scores, and make an array so its easier later in the code when working with them. the reason i want a property method is so i can prevent scores > 100 and < 0. before using properties, i simply made a variable array named Score, storing 3 values of test scores. i want to do this exact same thing, but limiting input, using properties.
this is what i have so far:
Property Score() As single
Get
Return tempScore
End Get
Set(ByVal Value As String)
If Value < 0 Then
Console.WriteLine("Score average cannot be less than 0%.")
tempScore = 0
ElseIf Value > 100 Then
Console.WriteLine("Score average cannot be greater than 100%.")
tempScore = 100
Else
tempScore = Value
End If
End Set
End Property
ANY HELP is SINCERLY appreciated.
sorry if its unclear, as im not used to this.
Thank you.
Jordan.
III
|
|
|
|
|
ok.. i guess i got it working. here it is, if anyone cares:
Private tempScore(3) As Integer
Property score(ByVal i As Byte) As String
Get
Return tempScore(i)
End Get
Set(ByVal Value As String)
If Value < 0 Then
Console.WriteLine("Score average cannot be less than 0%.")
tempScore(i) = 0
ElseIf Value > 100 Then
Console.WriteLine("Score average cannot be greater than 100%.")
tempScore(i) = 100
Else
tempScore(i) = Value
End If
End Set
End Property
Jordan.
III
|
|
|
|
|
Another CPian wrote to me in a separate email, asking "...trying to have a form, that when you click on a command button, the main form comes up. The first one would be an opening form, and the second the main program" I thought I'd post the first solution that occurred to me here, and ask if anyone else has a brighter idea.
Here's what I did. I create two forms, one named StartupForm, and one named MainForm. The form StartupForm is set as the startup object in the project's properties.
StartupForm:
Public Class StartupForm
Inherits System.Windows.Forms.Form
' Windows Form Designer generated code omitted
Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click
Dim myForm As New MainForm(Me) ' MainForm's constructor New is overloaded
Me.Hide() ' Make me invisible
myForm.Show() ' Display MainForm
End Sub
End Class
MainForm:
Public Class MainForm
Inherits System.Windows.Forms.Form
Private _caller As Object
' Windows Form Designer generated code omitted
Public Sub New(ByVal caller As Form)
MyBase.New()
InitializeComponent()
_caller = caller
End Sub
Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click
CType(_caller, Form).Close()
Me.Close()
End Sub
End Class
This was pretty quick & dirty, so there are probably some obvious enhancements to be made. Suggestions, comments, questions and revisions are invited...
|
|
|
|
|
I just thought of another way to implement the splash form by showing the SplashForm on the Load() event of the MainForm and hiding the MainForm.
Public Class MainForm
Inherits System.Windows.Forms.Form
 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim splashForm As New SplashForm()
splashForm.ShowDialog(Me)
Me.Hide()
End Sub
End Class
Public Class SplashForm
Inherits System.Windows.Forms.Form
 Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click
Me.Close();
Me.Owner.Show();
End Sub
End Class
I have tested it and it seems to be working fine.
Edbert P.
Sydney, Australia.
|
|
|
|
|
I like it. My only thought is that the other fellow was asking about two forms, neither of which sounded like a splash form when he described them to me.
Does Form1 flash on the screen at all before it hides itself?
|
|
|
|
|
When I tested it Form1 didn't flash at all.
I suppose since I implemented the code in the Form_Load event it hadn't showed the form itself before the code got triggered.
Edbert P.
Sydney, Australia.
|
|
|
|
|
That thought didn't dawn on me as soon as it should have...
|
|
|
|
|
Hai,
I've a component registed in my system. When i call the component from the ASP page it works fine. When I create an instance of the same component in VB Application, I get the error, object variable or with block variable not set. The error comes in the 3rd line of my code which i have specified below:
Dim Con_Getcon As New JBHRCom.GetConnection
Dim Con_ObjDB As New ADODB.Connection
Set Con_ObjDB = Con_Getcon.Connection
Could anyone help me out as soon as possible.
Thank you,
Regards,
K. Sripriya
|
|
|
|
|
It's pretty hard to give you a correct answer without knowing what kind of object JBHRCom is, but assuming that you stick to "talking" naming convention, GetConnection method returns an object of ADODB.Connection type. I would try something like this instead:
Dim Con_Getcon As New JBHRCom
Dim Con_ObjDB As New ADODB.Connection
Set Con_ObjDB = Con_Getcon.Connection
|
|
|
|
|
I want the text that we key in in the vb form must in Uppercase.What is the method's?Help....................help............
Hi, i have create a program using VB6.The purpose of this program are for sales department person key in the data and then review by manager.Now, my problem is manager want me to create a command button to export the data from microsoft access to excel.What is the command button code and the step? Another Question,this program must set up in the office and all the staff can see and use this program at their own PC's!Thank for ur help!
|
|
|
|
|
Upper case is : Ucase$(string)
Access to Excel: Add a reference to Microsoft Excel Object.
Public Class clsXL
Dim xl as Excel.Application
Private Sub Class_Initialize()
On Error Resume Next
Set xl = CreateObject("Excel.Application")
xl.DisplayAlerts = False
End Sub
Private Sub Class_Terminate()
' If IsLaunched Then xl.Application.Quit
Set xl = Nothing
End Sub
Public Function Export(rs As Recordset) as Boolean
dim ws as Worksheet
dim c as integer 'column
dim i as integer 'row counter
If Not xl Is Nothing Then
xl.Workbooks.Add
Set ws = xl.ActiveSheet
'Set the column headers
'....
'Now loop through the rows & columns of the recordset to add the values
i = 2
do while not rs.eof
for c = rs.fields.count
w.Cells(i, c) = .Fields(c).Value & vbNullString
i = i + 1
rs.movenext
next
loop
'Format work sheet further
'now print preview the sheet
xl.DisplayAlerts = False
xl.Visible = True
xl.ActiveWorkbook.Worksheets.PrintOut , , , True
xl.Visible = False
xl.Application.Quit
end if
End Function
By doing this he can do what ever he wants with the excel spreadsheet Save, Sent To or Print.
Hope this helps.
Michael
|
|
|
|
|
I want the text that we key in in the vb form must in Uppercase.What is the method's?Help....................help............
Hi, i have create a program using VB6.The purpose of this program are for sales department person key in the data and then review by manager.Now, my problem is manager want me to create a command button to export the data from microsoft access to excel.What is the command button code and the step? Another Question,this program must set up in the office and all the staff can see and use this program at their own PC's!Thank for ur help!
|
|
|
|
|
hint :
use SetWindowLong API passing the window handle of the text box and ES_UPPERCASE
|
|
|
|
|
Why not just do it the simple way:
in the keydown event just do a .toupper for the char and handle the event.
|
|
|
|
|
Hi
Which property shud i set to make button a default button, so that when it is clicked the event fires automatically.
Thanks
Tasnim
|
|
|
|
|
I believe what you are asking is which property sets a button to the button that is the default action for a form, such that press "Enter" causes the click event of that button.
That property is the AcceptButton property of the Form.
|
|
|
|
|
i am trying to open the default email client with attachment.
i have successfully opened the default client, but i am not able to have it with attachment.
How can i do this ?
Looking for Help.
Regards,
Asim
|
|
|
|
|
as topic, anyone can provide some codes that enable a scroll bar to a picturebox when the picture expand?
|
|
|
|
|
Drop 2 PictureBoxes on your form, so that Picture1 is Picture2's Container. Drop horizontal and vertical ScrollBar controls on proper positions around Picture1. Set Picture1.AutoSize = False and Picture2.AutoSize = True. As you load picture(s) into Picture2, execute the following code:
If Picture2.Width > Picture1.Width Then
ScrollBarH.Enabled = True
Else
ScrollBarH.Enabled = False
End If
If Picture2.Height > Picture1.Height Then
ScrollBarV.Enabled = True
Else
ScrollBarV.Enabled = False
End If
Hope, it helps.
|
|
|
|
|
In my previous posting I forgot to mention that you control the position of Picture2 relative to Picture1 (which is a Container, remember?) with your scrollbars. The code to do that seems trivial enough: the horizontal scrollbar has to increment/decrement the Picture.Left, while the vertical one controls Picture2.Top properties.
|
|
|
|