08-27-2008 07:53 AM
I have this code for read the current contact from ACT :but it is in vb can u convert in C#---It is very urgent.Please help me...........
Private Sub GetCurrentContactField()Thanks........
'create a contact object
Dim contact As Act.Framework.Contacts.Contact
'get the current contact
contact = ActApp.ApplicationState.CurrentContact
'get the address 1 field value
Dim Add1 As String = contact.Fields("Contact.Address 1", False)
'display the value
08-27-2008 09:10 AM
first part is mthod signature
next line instantiating a Contact object
third line assigning the defined object from lin2
4th line instantiating a new string object and assigning it the value of of the contact field "Contact. Address 1" which is a non system field (i.e.false)
5th line - System.Windows.Forms.MessageBox.Show(string);
not much more to it really. Remeber them semi colons.
Or you could try and apply the filters to the Sample Code and select C#
08-27-2008 09:16 AM
When we compile this code so it will give error(4th line instantiating a new string object and assigning it the value of of the contact field "Contact. Address 1" which is a non system field (i.e.false)) that here Fields is a property can't use as a method.Vivek can u give me your ph no..
08-27-2008 11:47 AM
Here are two web pages that I find invaluable for converting vb to c# and c# to VB:
-- jim durkin
08-31-2008 01:26 AM
thanks for this .code is working.CAN U TELL ME HOW CAN Make a drop down just like --Business_City (ACT).I want this type of drop down in our c#.net dialog.For making a dll.
09-01-2008 09:56 AM
I just haven't been able to work this one out. Hopefully someone might be able to shed some further light on where I am going wrong in my code, otherwise my conclusion has been that its just not possible since I can not work out how to write to the FieldDescriptor.FieldDescriptorCollection object and Add() a new Attribute to it...
ActFramework oFram = new ActFramework();
oFram.LogOn(@"C:\Users\xxx\Documents\ACT\ACT for Windows 10\Databases\ACT10Demo.PAD", "Chris huffman", "");
oFram.PickLists.CreatePickList(Act.Framework.PickLists.PickListType.Character, "User 1"); //Create new Picklist unpopulated
Act.Framework.PickLists.PickList pList = oFram.PickLists.GetPickList("User 1"); //Gets our Picklist we just made
FieldDescriptorCollection fields = oFram.Fields.GetFields(RecordType.Contact); //Gets all the Contact FieldsFieldDescriptor fD = fields.Find("User 1"); //Gets the User 1 Field. We want to assign our PickList to this Field:
FieldDescriptor.FieldDescriptorAttributeCollection attribs = fD.Attributes;
PickListAttribute plAttrib = new PickListAttribute(pList, false, true, true, true);
//can not set the attribute since attribs is readonly!
I hope I am doing something really stupid and thre is a way, I have a batch utility that could do with this working!
If not, Feature Request can we make the FieldDescriptor.FieldDescriptorAttributeCollection (get, set) Have a Public method?
09-01-2008 03:31 PM
Not sure what is being requested. Do you want to create a Drop Down List? Do you want to add items to a Drop Down List? Or do you want to associate a file with a Drop Down List? I do all of these in my Batch Field Creator Pro product, and would be happy to hwlop (it's in VB, not C#), but I don't know what you're trying to do. And perhaps you should start a new thread with the correct subject, so that others can pitch in?
09-02-2008 03:20 AM
field.Attributes(Act.Framework.Database.FieldProperty.PickList) = New Act.Framework.Database.PickListAttribute(ActApp.ActFramework.PickLists.GetPickList(Picklist), True, False, True, False)