function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CJDEVCONPROCJDEVCONPRO 

List all of my Account ID's and main number into a ListBox

Is there a way I can list all of my account ID's with main phone numbers into a List Box control?
Gareth DaviesGareth Davies
Select ID,Phone from Account Where ID != '1'
Gareth DaviesGareth Davies
Or if it's list boxes that are the problem

MyListBox.Items.Clear();

foreach (MyAccountObject Account in MyCollectionOfAccountObjects)
{
MyListBox.Items.Add(Account.ID.ToString() + " " + Account.Phone.ToString());
}
SuperfellSuperfell
or just Select ID,Phone from Account (not need for the bogus where clause)
Gareth DaviesGareth Davies
Yeah that would be better!
Tnx Simon.

Gareth
CJDEVCONPROCJDEVCONPRO
I am trying to use the VB.NET Search sample. Is there a way within that sample to perform this listbox load?
CJDEVCONPROCJDEVCONPRO
Actually I figured it out. Here is the code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
login()
Dim qr As sforce.QueryResult = binding.query("Select Id, Name, AccountNumber from Account")
For i As Integer = 0 To qr.records.GetUpperBound(0)
Dim account As sforce.sObject = qr.records(i)
ListBox1.Items.Add((i + 1) & ": " & getFieldValue("Name", account.Any) & " " & getFieldValue("AccountNumber", account.Any))
Next

End Sub