An exercise that can help you is to first pick a key and write out a melody.
Once you got a melody written out, write down all possible chords that can go with each melody note that is associated to the key you are in. Then, try out different combinations. Progressions help with the combo process a lot. Let's do one for example:
Key C
Melody line: C, D, E, F, E, D, B, D, C
Chords in key of C w/inversions:
C-E-G, E-G-C, G-C-E
D-F-A, F-A-D, A-D-F
E-G-B, G-B-E, B-E-G
F-A-C, A-C-F, C-F-A
G-B-D, B-D-G, D-G-B
A-C-E, C-E-A, E-A-C
B-D-F, D-F-B, F-B-D
Melody line with possible chords:
C = E-G-C, F-A-C, E-A-C
D = F-A-D, G-B-D, F-B-D
E = G-C-E, G-B-E, A-C-E
F = A-D-F, A-C-F, B-D-F
E = G-C-E, G-B-E, A-C-E
D = F-A-D, G-B-D, F-B-D
B = E-G-B, D-G-B, D-F-B
D = F-A-D, G-B-D, F-B-D
C = E-G-C, F-A-C, E-A-C
All that's left is to come up with your own combos. I would go ahead and write out the C major chords for the first and last note cuz u in the key of C and u probably want to start and end with a 1 chord:
C = E-G-C
D = F-A-D, G-B-D, F-B-D
E = G-C-E, G-B-E, A-C-E
F = A-D-F, A-C-F, B-D-F
E = G-C-E, G-B-E, A-C-E
D = F-A-D, G-B-D, F-B-D
B = E-G-B, D-G-B, D-F-B
D = F-A-D, G-B-D, F-B-D
C = E-G-C
Now, let's go to the end. What chord usually comes before 1 chord? Yup, u guessed it, a 5 chord so let's fill that in:
C = E-G-C
D = F-A-D, G-B-D, F-B-D
E = G-C-E, G-B-E, A-C-E
F = A-D-F, A-C-F, B-D-F
E = G-C-E, G-B-E, A-C-E
D = F-A-D, G-B-D, F-B-D
B = E-G-B, D-G-B, D-F-B
D = G-B-D
C = E-G-C
You see what I mean? If you can practice doing this then when you see a melody line, you'll already begin to formulate in your mind what chords you want to play with each note.