Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Getting the value of column 1 when doubleclicking
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Getting the value of column 1 when doubleclicking

 Post Reply Post Reply
Author
Message
Soren View Drop Down
Newbie
Newbie
Avatar

Joined: 09 May 2007
Location: Denmark
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Soren Quote  Post ReplyReply Direct Link To This Post Topic: Getting the value of column 1 when doubleclicking
    Posted: 18 May 2007 at 10:56am
Hi.
 
I use a reportControl to read customers from my MySQL-database.
 
When I double-click a certain row, I would like to get the customer-number which is placed i the first column.
 
I think I shall use my CustList.RowDblClick, or am I wrong?
 
 
Back to Top
Zach View Drop Down
Groupie
Groupie


Joined: 19 July 2006
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Zach Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2007 at 12:36pm
RowDblClick event
 
 
Then its as easy as
 
msgbox Row.Record(0).Value
Back to Top
Soren View Drop Down
Newbie
Newbie
Avatar

Joined: 09 May 2007
Location: Denmark
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Soren Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2007 at 4:16pm
Hi Zach.
 
Thank You for your reply, but it does not work.
 
When I use your code, I get the row number and not the content.
Back to Top
moe188 View Drop Down
Senior Member
Senior Member


Joined: 27 March 2006
Status: Offline
Points: 220
Post Options Post Options   Thanks (0) Thanks(0)   Quote moe188 Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2007 at 5:51pm
hi,
try this with reprotcontrol selection changed or rowdoublclick
        If Not wndview.FocusedRow.GroupRow Then
            CustomeNumber = wndview.FocusedRow.Record(Col1).Value
        end if
I hope that will work for you
 
Back to Top
Soren View Drop Down
Newbie
Newbie
Avatar

Joined: 09 May 2007
Location: Denmark
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Soren Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2007 at 6:06pm
I think there is something wrong.
I've tried
       If Not wndview.FocusedRow.GroupRow Then
            CustomeNumber = wndview.FocusedRow.Record(Col1).Value
        end if
 
and it returns the row number
 
And if I do this:
       If Not wndview.FocusedRow.GroupRow Then
            CustomeNumber = wndview.FocusedRow.Record(SOME_RUBBISH).Value
        end if
 
the row number is returned too.
 
Could there be som settings missing in the report control?
Back to Top
Zach View Drop Down
Groupie
Groupie


Joined: 19 July 2006
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Zach Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2007 at 7:18pm
Dont know what to tell you..
 
 
I have a RowDblClick even that looksl ike this... in VB6 ... and works perfectly
 
Private Sub Data_RowDblClick(ByVal Row As XtremeReportControl.IReportRow, _
                             ByVal Item As XtremeReportControl.IReportRecordItem)
 
    MsgBox Row.Record(4).Value
 
End Sub
 
 
You can also try Row.Record(4).Caption ... depending on what you are doing... you may need to do that.
Back to Top
Soren View Drop Down
Newbie
Newbie
Avatar

Joined: 09 May 2007
Location: Denmark
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Soren Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2007 at 7:35pm
Hi Zack
 
This is what I do:
 
First, I create the headers
    frmKontakter.CustomerList.Columns.Add 0, "Customer Number", 25, True
    frmKontakter.CustomerList.Columns.Column(0).Groupable = False
    frmKontakter.CustomerList.Columns.Add 1, "Company name", 100, True
    frmKontakter.CustomerList.Columns.Add 2, "Address", 100, True
    frmKontakter.CustomerList.Columns.Add 3, "ZIP", 50, True
Then I add the data:
 
aCount = rsTable.RecordCount
rsTable.MoveFirst
a = 0
While a < aCount
        Set Record = CustomerList.Records.Add
        Set Item = Record.AddItem(a)
        Item.Format = rsTable.Fields!CustomerNUmber
        Set Item = Record.AddItem(Str)
        Item.Format = rsTable.Fields!CompanyName
        Set Item = Record.AddItem(Str)
        Item.Format = rsTable.Fields!Address
        Set Item = Record.AddItem(Str)
        Item.Format = rsTable.Fields!ZIP

        a = a + 1
        rsTable.MoveNext
Wend
CustomerList.Populate
Back to Top
moe188 View Drop Down
Senior Member
Senior Member


Joined: 27 March 2006
Status: Offline
Points: 220
Post Options Post Options   Thanks (0) Thanks(0)   Quote moe188 Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2007 at 8:21pm
Hi Zac
I used the same code with the SelectionChanged events to get the value of the first column with no problems. then when I double click on reportcontrol (RowDblClick events), I check for the value of the first column, if the value is empty I don't do nothing otherwise I do whatever I want to do base on the value of column 1.
good luck.
 
Back to Top
Zach View Drop Down
Groupie
Groupie


Joined: 19 July 2006
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Zach Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2007 at 12:27am
Originally posted by Soren Soren wrote:

Hi Zack
 
This is what I do:
 
First, I create the headers
    frmKontakter.CustomerList.Columns.Add 0, "Customer Number", 25, True
    frmKontakter.CustomerList.Columns.Column(0).Groupable = False
    frmKontakter.CustomerList.Columns.Add 1, "Company name", 100, True
    frmKontakter.CustomerList.Columns.Add 2, "Address", 100, True
    frmKontakter.CustomerList.Columns.Add 3, "ZIP", 50, True
Then I add the data:
 
aCount = rsTable.RecordCount
rsTable.MoveFirst
a = 0
While a < aCount
        Set Record = CustomerList.Records.Add
        Set Item = Record.AddItem(a)
        Item.Format = rsTable.Fields!CustomerNUmber
        Set Item = Record.AddItem(Str)
        Item.Format = rsTable.Fields!CompanyName
        Set Item = Record.AddItem(Str)
        Item.Format = rsTable.Fields!Address
        Set Item = Record.AddItem(Str)
        Item.Format = rsTable.Fields!ZIP

        a = a + 1
        rsTable.MoveNext
Wend
CustomerList.Populate
 
 
If that is in someway is close to your exact code... uh... what did you expect?
 
You are placing a count into the first column?
 
I also assume you define a value for Str elsewhere.. but this:
 
 
        Set Item = Record.AddItem(a)
 
 
listed like that .. when the others are listed like:
 
 
        Set Item = Record.AddItem(Str)
 
 
 
Would as I said... make me think that you are assigning the value to Str elsewhere... and just used that for filler... but the first one.. it really looks like you put in "a" there... or its value anyway... which would make it so that when you double click on it... you are going to get what looks like a row number...
 
... if you post the actual code... from the select statement to the end of the loop of the results... I can probably have a better clue what is wrong...
Back to Top
Zach View Drop Down
Groupie
Groupie


Joined: 19 July 2006
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Zach Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2007 at 12:33am
I never use the format part of the Report Control... but I just realized.. you did just post your actual code :)
 
You are formatting each cell to look like your result... hum... interesting... might be an interesting trick to use sometime... but... uh.. why?
 
 
 
 
        Set Record = CustomerList.Records.Add
        Set Item = Record.AddItem(rsTable.Fields!CustomerNUmber)
        Set Item = Record.AddItem(rsTable.Fields!CompanyName)
        Set Item = Record.AddItem(rsTable.Fields!Address)
        Set Item = Record.AddItem(rsTable.Fields!ZIP)
 
... That I think will get you what you want... sorry I missed that the first time... as I said.. I do not use the format property and I have never used the Microsoft way of pulling in fields from a table so I just ignored that part in my mind at first
Back to Top
Soren View Drop Down
Newbie
Newbie
Avatar

Joined: 09 May 2007
Location: Denmark
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Soren Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2007 at 4:26am
Hi again Zach
 
Thank you very much for your help.
You really got me right on track.
 
At first, I did:
      Set Item = Record.AddItem(rsTable.Fields!CustomerNUmber)
 
but the List stayed empty
 
Then I started thinking about what you said about formatting.
 
So, now I do this:
   Set Item = Record.AddItem(CInt(rsTable.Fields!CustomerNUmber))
   Set Item = Record.AddItem(CStr(rsTable.Fields!CompanyName))
 
 
And everything is pure happiness
Back to Top
Zach View Drop Down
Groupie
Groupie


Joined: 19 July 2006
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Zach Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2007 at 3:40pm
Cool... I actually thought about adding CInt, CStr... but then just didnt.. my bad :(
 
 
Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post Posted: 30 October 2007 at 6:06am
You don't need the CInt/CStr-Conversion, because you put the Fieldobject to the Item and not the default-property.
 
Expand your Code with
Set Item = Record.AddItem(rsTable.Fields!CustomerNUmber.Value)
 
This save time and also the content-type stays there (eg. Date/Str/Double/int/...)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.