Search results for query: *

  1. S

    Possible loop problem

    {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
  2. S

    Question Adding a range of numbers efficiently

    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...
  3. S

    Question Adding a range of numbers efficiently

    {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)
  4. S

    Input language

    {Be hAppy} You can ommit one line from the written code: TextBox1.Text = InputLanguage.CurrentInputLanguage.LayoutName
  5. S

    Question Convert controls

    {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)
  6. S

    Question Free memory of .net objects

    {Be hAppy} You need to read documentation of "garbage collection in .net" and try to implement this.
  7. S

    Question Date Problem

    I can see different references like: System.Data System.Drawing System.Windows.Forms etc But Microsoft.VisualBasic is not available in the list.
  8. S

    Question Date Problem

    {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))
  9. S

    Question Random number in range is outside range

    {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
  10. S

    Question Random number in range is outside range

    {Be hAppy} This is infinite loop as per mathematics because RND() value can not be equal to one so the written can not bring 9 mathematically. Actually it should be infinite loop theoratically But practically its not because of computational limitation... Let me explain In following code you...
  11. S

    Question Date Problem

    {Be hAppy} Dear IntertiaM, How can I remove the Microsoft.VisualBasic reference. Usually I don't add using Imports ...
  12. S

    Get username and password from LoginControl

    (Be hAppy} MsgBox environ("username") Password - If you are administrator you can change but you can not see the existing one.
  13. S

    Question Date Problem

    {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...
  14. S

    Question Date Problem

    {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 =...
  15. S

    Question Date Problem

    {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...
  16. S

    Regex for case insensitive registry search

    {Be hAppy} Alternate way (if you don't want to use Option Compare Text) is: If root.Name.ToLower.Contains(searchKey.ToLower) Then
  17. S

    Regex for case insensitive registry search

    {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.
  18. S

    Regex for case insensitive registry search

    {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 ....
  19. S

    Enter Key function as TAB Key

    {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}"
  20. S

    Question Listview Items and Subitems ?

    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)...
Back
Top