Link to home
Start Free TrialLog in
Avatar of narmi2

asked on

How to use this class - Part 4

Dear Experts,

Continuing on from here:

Using the following part:

public imSearchEmail SearchEmail;

From the class:

public class SearchDocumentsInput
public string[] Databases;
public imProfileAttributeID[] OutputProfile;
public ProfileSearchParameter[] ProfileSearchParameters;
public imSearchEmail SearchEmail;
public FullTextSearch FullTextSearch;
public OutputMask OutputMask;

I have done the following:

        Dim objSearchEmail(2) As imSearchEmail

        objSearchEmail(0) = imSearchEmail.imSearchDocumentsOnly
        objSearchEmail(1) = imSearchEmail.imSearchEmailOnly
        objSearchEmail(2) = imSearchEmail.imSearchEmailOrDocuments

Does this look right?

Avatar of jazz__man

You need to creat an instance of your class before you can use anything contained within it.

Dim SearchDocInput As New SearchDocumentsInput

SearchDocInput.SearchEmail(0) = ....
SearchDocInput.SearchEmail(1) = ....
Avatar of narmi2


So have I done parts 1,2, and 3 incorrectly?
Avatar of Nasir Razzaq
No you are fine

I said to you previously that these questions are linked to each other. You put the same comment in previous part as well. Kindly read the full question and check the links in the question before you post your comment to avoid misleading the asker.
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of narmi2


Yes, imSearchEmail is an enum

public enum imSearchEmail
imSearchEmailOrDocuments = 0,
imSearchEmailOnly = 1,
imSearchDocumentsOnly = 2,

However, when I try to add this to SDI, I cannot, as the following does not seem to exist

objSearchWorksiteInput.imSearchEmail = objSearchEmail

The message I get is

Error      1      'imSearchEmail' is not a member of 'SearchWorkspacesInput'.      C:\My Documents From C\iConnection\Default.aspx.vb      129      9      iConnection

Avatar of narmi2


sdi.imSearchEmail = objSearchEmail

gives me

Error      1      'imSearchEmail' is not a member of 'SearchWorkspacesInput'.      C:\My Documents From C\iConnection\Default.aspx.vb      129      9      iConnection
Avatar of narmi2


Sorry again, typo

I have

sdi.imSearchEmail = objSearchEmail

and the error I get is

Error      1      'imSearchEmail' is not a member of 'SearchDocumentsInput'.      C:\My Documents From C\iConnection\Default.aspx.vb      129      9      iConnection
Avatar of narmi2


Nevermind, figured it out.  Only one more to go I hope...
hmm. Post that link here then.
 What part of the question have I misunderstood??

"Kindly read the full question and check the links in the question before you post your comment to avoid misleading the asker."

I did read the entire question. I read every part thoroughly!!

I then did my best to help the asker. I even ran my own tests in visual studio to make sure they worked.

You keep suggesting to create an instance of the class. You suggested that in two parts of the question even when that part has been sorted in the first part of the question. I would be surprised if you can access members of an array which is declared as public imProfileAttributeID[] OutputProfile;
Avatar of narmi2


I have been sidetracked.  I will post the next part as soon as I can.  Maybe later today.

Without a strand of evidence you implicate that I did not read the question and this is totally unfair and untrue.

I read the full question, and did my very best to help the asker. As I said I tested a very similar solution in visual studio before posting.

You suggestions in both parts of the question were an evidence that you either did not read the question or misunderstood it.
Secondly, the arrays in the class are declared without bounds which means you can not directly access their members (you would get a nullreference exception). So you need to declare the arrays with bounds and then assign them to the class variable.
Again you are making assumptions!

You are making assumptions that I and the asker do not know how arrays work?

I fully inderstand how arrays work. Please spare me the .net lesson I've been at it 10 years now.

You were point blank wrong to accuse me of not reading the question when you have absolutely no proof whatsoever!!!. Now you are being even more rude by trying to justify what did!!

Want some advice? Before you advise others make sure you work with facts, because assumptions just lead you into great big holes.

Ok. I will look into hiring some detective agency for gathering the proofs of you not understanding the question. The question is solved now so i think i would rather focus on my project. The acceptance of the answer is an indicator in itself.

By the way, in my version of visual studio 2008, i get a null reference exception when i try this code

dim str() as string

I am generally a very easy going person but please be a little more tolerant with people. Even if you were right, there is a way of saying things.

This would work though...

    public class ArrayTest
        public string[] MyArr = new string[3];


            ArrayTest ArrTest = new ArrayTest();
            ArrTest.MyArr[0] = "Item1";
            ArrTest.MyArr[1] = "Item2";
            ArrTest.MyArr[2] = "Item3";

            lblTest.Text = ArrTest.MyArr[0] + " " + ArrTest.MyArr[1] + " " + ArrTest.MyArr[2];

What I was doing was trying to give the asker a general pointer to the usage of his class thats all.

"The man thats never made a mistake has never made anything"

Have a nice day.

The only reason i criticized your post was that i was answering the different parts of the question from start and we had already discussed the part of creating the object etc. I knew from the class declaration that the arrays are declared using the
dim str() as string
method so we can not assign values to the array elements directly.