{Be hAppy}
a=int(val(inputbox("Enter a number")))
msgbox a*(a+1)/2
OR
a=int(val(inputbox("Enter a number")))
dim sum as integer=0
for i as integer=1 to a
sum += i
next
msgbox sum
Dear JohnH
Yes my new code is approximately same but it is not limited the variable types - I mean it can be Integer, Long, Single, Double etc.
If you are interested for some other sort of coding then please see this one:
Private Sub GetSum()
Dim A(5)
A(0) = 5
A(1) = 5...
{Be hAppy}
'Say your array name is A or any type
Dim Sum As Object = 0
For Each c As Object In A
if not c is nothing then
Sum += Val(c.ToString)
end if
Next
MsgBox(Sum)
{Be hAppy}
Dim Test2 as combobox=ctype(test1,ComboBox)
OR
Change:
Private Sub test(ByRef test1 As System.Windows.Forms.Control)
as
Private Sub test(ByRef test1 As ComboBox)
{Be hAppy}
Dim MyDate As Date = DateSerial(2009, 12, 14)
Dim StartDate As Date = New Date(MyDate.Year,MyDate.Month,1)
Dim EndDate As Date = New Data(MyDate.Year,MyDate.Month,date.DaysInMonth(MyDate.Year,MyDate.Month))
{Be hAppy}
say
min= 1000
max = 9999
if you want to pick any value between this range then use:
x=min+int(rnd()*(max-min+1))
Then x will always be a number between 1000 and 9999
...= 0
Dim GoldButtonNumber As Integer = 0
Dim h As Double
Do
h = Rnd()
GoldButtonNumber = CInt(Int((8 * h) + 1))
LoopCount += 1
Loop Until GoldButtonNumber > 8
MsgBox("Not Infinite Loop")
===========
Just change the...
{Be hAppy}
Dear IntertiaM
Thats great. Thanks for your comments. I realy need to start exploring new things ...
Off course easy syntax can make like easy ... and in future I will adopt the same as you mentioned.
In fact I am logical but lazy and explore some thing upto my requirements.
One...
{Be hAppy}
There is one mistake in already provided code:
Use the following one instead:
Dim StartDate As Date = Nothing
Dim EndDate As Date = Nothing
Dim MyDate As Date = DateSerial(2009, 12, 14)
If MyDate.Day < 17 Then
StartDate = DateSerial(MyDate.Year, MyDate.Month, 1)
EndDate =...
{Be hAppy}
Dim StartDate As Date = Nothing
Dim EndDate As Date = Nothing
Dim MyDate As Date = DateSerial(2009, 12, 14)
If MyDate.Day < 17 Then
StartDate = DateSerial(MyDate.Year, MyDate.Month, 1)
EndDate = DateSerial(MyDate.Year...
{Be hAppy}
Just now I discovered that Contains function does not work under option compare text.
So change your this line:
If root.Name.Contains(searchKey) Then
as
If instr(root.Name,searchKey)<>0 Then
But don't forget to add option compare text at the top of the module.
{Be hAppy}
If you are adding:
Option Compare text
then
msgbox instr("AbcDef","cde") will return TRUE
otherwise it will return FALSE.
Have you tried after adding this ....
{Be hAppy}
Just include all controls like
Textbox1.KeyPress, Textbox2.KeyPress, Textbox3.keyPress and so on.
In code at the place of:
Textbox2.Select use:
Sendkeys.Send "{TAB}"
Change as:
Dim sql As String
sql = "select * from USERDATA"
rs.Open(sql, cn, 1, 3)
Do Until rs.EOF
Dim LVI As New ListViewItem(rs.Fields("Field1").Value.ToString)
LVI.SubItems.Add(rs.Fields("Field2").Value.ToString)...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.