Get Key and value from a dictionary

How can I retrieve key and value of a dictionary and store key and value in a different variables.
I have a dictionary of Key as string and Value as array of Int32. I want to extract key and value
I am using a for each loop to retrieve a single data at a time.

So, I am facing error in getting data for key

Can you hover the error icon and post the message you have there @Rajat_16?

I hope you are trying to assign a wrong data type value

Sorry for so many questions, can you post the data type of Date_value, if it is a string, then you won’t get that error

Hello Rajat,

Why don’t you try using a For Each with your dictionary and see the index of the items that you want?

For example; item(0).ToString MAY BE your Key as an string
item(1).ToString may be one of the values that you want as an string

I think that may solve your problem.

Give it a try and tell me!

Kind regards,
Daniel

Hi @Rajat_16,

You have to do two things:

First:

When you are assigning value to Date_Value then in that time please convert the key value to ToString.

Dict_Month_Date(Key.ToString)

Second:

To iterate through each and every item of Int32[] you have to introduced one more for each.

Attaching XAML for your reference.

Main.xaml (7.7 KB)

If it solves your query then please mark it as a solution.

Thanks.

I have already tried that. Basically the Date_Value should be an array of Int32 with dates of the month in it. All i want to is to get those that values based on key which are months

Thanks alot

1 Like

Anytime. Cheers :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.