Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 132,358 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,148 people online right now. Registration is fast and FREE... Join Now!




Help with my thread?

 
Reply to this topicStart new topic

Help with my thread?

gabehabe
post 1 Oct, 2008 - 09:47 AM
Post #1


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


Hey~ I'm working on my Twitter application (I don't know if you've already seen it, it's here if you want to see)

I had this feature working, and then I changed the code a little. Now, I can't remember for the life of me how to get it working again.

First off, I initialise "latest" on the main form's load event.

Then, in the thread, I call the function to update the "friend updates" panel (check the project thread) to add the latest to the top if it isn't already there.

So, here's the code which is being called via the Invoke() method of my panel:
csharp
	void UpdateIt()
{
Twitter.Tweet check = Twitter.GetLatestUpdateFromHome(this.username, this.password);
if (this.latest.Name != check.Name && this.latest.Content != check.Content)
{
int y = 0;
foreach (Control ctrl in this.FriendUpdates.Controls)
{
y += 100;
ctrl.Location = new Point(ctrl.Location.X, y);
}
Panel p = new FriendPanel(latest.Name, latest.Content, latest.Picture);
this.FriendUpdates.Controls.Add(p);
this.latest = check;
}
}

Basically, I'm aiming to move them all down by 100 (their height) and add a new one to the top. That looks fine to me~
The problem is that the if statement never seems to be entered. (I've come to this conclusion by putting a MessageBox before/after the if statement~ the first is shown (indicating that the method is being called correctly) but the if isn't being entered.


Thanks in advance
-Danny
User is offlineProfile CardPM

Go to the top of the page

Jayman
post 1 Oct, 2008 - 10:42 AM
Post #2


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,839



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


What data type are the Name and Content properties?

Is Twitter.GetLatestUpdateFromHome returning a value?
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 1 Oct, 2008 - 10:47 AM
Post #3


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


Name and Content are both strings, which are stored in a struct called Tweet.

GetLatestUpdateFromHome() returns a Tweet.

It is working, I've checked the return values~ I tried using
MessageBox.Show(latest.Name) just to check, and I got the result that I expected~

I just don't understand why it's not entering the statement~
User is offlineProfile CardPM

Go to the top of the page

Jayman
post 1 Oct, 2008 - 11:07 AM
Post #4


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,839



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


What are the criteria that defines when it should enter the IF statement?

Currently, if both the Name and Content don't match that is the only way it will enter the statement. If you put a break on the IF statement, what are the values contained in:

this.latest.Name
check.Name
this.latest.Content
check.Content

If you can post a screen shot of the Autos window when it hits the break, so I can see exactly what the values are that would be great.
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 1 Oct, 2008 - 11:15 AM
Post #5


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


Sorry, I'm a dumbass at the best of times. I've figured it out.

It's because it was me posting different updates each time, checking it, right?

Well, look closely at the if statement. It looks for the name AND the content to be different. In other words, I'm posting a test update, and it's seeing my name from the last post, too~

How stupid can I be?

Thanks anyway~
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 04:13AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month