Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,584 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,961 people online right now. Registration is fast and FREE... Join Now!




Project on VB6

 
Reply to this topicStart new topic

Project on VB6, Working on tables

vishalghabak
6 Oct, 2008 - 08:20 AM
Post #1

New D.I.C Head
*

Joined: 27 Aug, 2008
Posts: 8


My Contributions
hi everyone,
i am new to VB6 programming language and i am working on a project called 'Network Monitoring System', Where i am working on a file which is in a tabular form.The very first column has various strings(words/Alarms/eg.'major','critical','normal',ect.). and the other columns have details of that particular alarm(time,type,etc).There are several such rows. Now i want to SORT OUT each type of alarm .i.e. on clicking 'major' command button i get all the Major alarms(strings) in tabular form along with the remaining details(time,type,etc.) , on clicking 'critical' command button i get all the critical alarm(string) , and so on.this can be done by comparing the string and then displaying.i tried applying some logic but it didn't work.

this is a part of a entire program

CODE

  Private Sub major_Click()

Dim Row As Integer
Dim Column As Integer
    For Row = 1 To 15
      Column = 1

       ‘grdSales-grid in which the data to be sorted is stored

       grdSales.Row = Row
       grdSales.Col = Column

      if  curData(Row, Column) = “major” then
            “HOW TO COMPARE  AND DISPLAY THE DATA, PLS HELP “

   Next Row

End sub

Thank You


** Edit ** code.gif
User is offlineProfile CardPM
+Quote Post

jaakko
RE: Project On VB6
6 Oct, 2008 - 11:43 AM
Post #2

New D.I.C Head
*

Joined: 26 Sep, 2008
Posts: 21



Thanked: 1 times
My Contributions
CODE

Private Sub Command1_Click()
  Dim alarm(15, 5) As Variant
  For m = 1 To 15
      alarm(m, 1) = "Put the string here "
      For n = 2 To 5 'put here the other information: time (2), code(3) etc
          alarm(m, n) = 0
      Next
  Next
  ' search of a certain string
  alarm(5, 1) = "Try to find this"
  cSearch = "Try to find this"
  lfound = False
  nFound = 0
  For m = 1 To 15
      If cSearch = alarm(m, 1) Then
          lfound = True
          nFound = m
      End If
  Next
  
  If lfound Then Text2.Text = Str(nFound) + " " + alarm(nFound, 1)
End Sub


** Edit ** code.gif
User is offlineProfile CardPM
+Quote Post

akhileshbc
RE: Project On VB6
6 Oct, 2008 - 11:11 PM
Post #3

D.I.C Head
Group Icon

Joined: 26 Sep, 2008
Posts: 177



Thanked: 3 times
Dream Kudos: 50
My Contributions
For string concatenation, use & sign smile.gif rather than using + sign...
User is offlineProfile CardPM
+Quote Post

vishalghabak
RE: Project On VB6
7 Oct, 2008 - 06:21 AM
Post #4

New D.I.C Head
*

Joined: 27 Aug, 2008
Posts: 8


My Contributions
QUOTE(jaakko @ 6 Oct, 2008 - 12:43 PM) *

CODE

Private Sub Command1_Click()
  Dim alarm(15, 5) As Variant
  For m = 1 To 15
      alarm(m, 1) = "Put the string here "
      For n = 2 To 5 'put here the other information: time (2), code(3) etc
          alarm(m, n) = 0
      Next
  Next
  ' search of a certain string
  alarm(5, 1) = "Try to find this"
  cSearch = "Try to find this"
  lfound = False
  nFound = 0
  For m = 1 To 15
      If cSearch = alarm(m, 1) Then
          lfound = True
          nFound = m
      End If
  Next
  
  If lfound Then Text2.Text = Str(nFound) + " " + alarm(nFound, 1)
End Sub


** Edit ** code.gif

THANKS FOR THE ABOVE CODE.I TRIED THE CODE, BUT I HAVE SOME PROBLEM.I TRIED THE FOLL WAY:


Private Sub cmdShow_Click()

Dim alarm(19, 7) As Variant
For m = 1 To 19
alarm(m, 1) = "Major"
For n = 1 To 7 'put here the other information: time (2), code(3) etc

grdSales.Row = m
grdSales.Col = n
alarm(m, n) = grdSales.Text

Next
Next

' search of a certain string

alarm(19, 0) = "Major"
cSearch = "Major"
lfound = False
nFound = 0
For m = 1 To 19
If cSearch = alarm(m, 1) Then
lfound = True
nFound = m
End If
Next

If lfound Then Text2.Text = Str(nFound) + " " + alarm(nFound, 1)



End Sub


I AM NOT GETTING THE DISPLAY IN THE NEW GRID.I WANT TO DISPLAY ALL THE MAJOR ALARMS IN ONE COLUMN AND IN CONSECUTIVE ROWS i.e. ONE AFTER ANOTHER WITH THE REMAINING COLUMNS DISPLAYING THE ACTUAL DATA FROM THE ORIGINAL GRID.TELL ME THE MODOFICATION IN THIS CODE.


User is offlineProfile CardPM
+Quote Post

akhileshbc
RE: Project On VB6
7 Oct, 2008 - 07:40 AM
Post #5

D.I.C Head
Group Icon

Joined: 26 Sep, 2008
Posts: 177



Thanked: 3 times
Dream Kudos: 50
My Contributions
The general syntax of a for loop is somewhat like this:

for i= 1 to 10
msgbox "hai"
next i

in ur code, the variable is missing after the "next".
User is offlineProfile CardPM
+Quote Post

vishalghabak
RE: Project On VB6
9 Oct, 2008 - 06:37 AM
Post #6

New D.I.C Head
*

Joined: 27 Aug, 2008
Posts: 8


My Contributions
QUOTE(jaakko @ 6 Oct, 2008 - 12:43 PM) *

CODE

Private Sub Command1_Click()
  Dim alarm(15, 5) As Variant
  For m = 1 To 15
      alarm(m, 1) = "Put the string here "
      For n = 2 To 5 'put here the other information: time (2), code(3) etc
          alarm(m, n) = 0
      Next
  Next
  ' search of a certain string
  alarm(5, 1) = "Try to find this"
  cSearch = "Try to find this"
  lfound = False
  nFound = 0
  For m = 1 To 15
      If cSearch = alarm(m, 1) Then
          lfound = True
          nFound = m
      End If
  Next

  
/  [u]If lfound Then Text2.Text = Str(nFound) + " " + alarm(nFound, 1)[/u]/
'I DID NOT UNDERSTAND WHAT THE ABOVE LINE WILL DO. CAN U EXPLAIN ME/

End Sub


** Edit ** code.gif


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 12:46AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month