FlowLayoutPanel1 and controls
-
Hi, Currently when I add a new control to the FlowLayoutPanel1, it gets added to the bottom of all the previous controls that were added in FlowLayoutPanel1. Is there a way that I can add the new controls to the top of FlowLayoutPanel1? I have added a small diagram of what I want: http://foto.pk/images/havewant.png[^] Please note that the flowdirection property isn't giving me the effect that I need. Because new items (controls) are added while the app is running. Source code of the application added: http://www.mediafire.com/?1uo8zd3ybgdmiwp[^] *Note: The above download has all the twitter keys for my account so you don't have to make a new account or anything. Please don't misuse it. Can you please add that feature that I want in the source?
-
Hi, Currently when I add a new control to the FlowLayoutPanel1, it gets added to the bottom of all the previous controls that were added in FlowLayoutPanel1. Is there a way that I can add the new controls to the top of FlowLayoutPanel1? I have added a small diagram of what I want: http://foto.pk/images/havewant.png[^] Please note that the flowdirection property isn't giving me the effect that I need. Because new items (controls) are added while the app is running. Source code of the application added: http://www.mediafire.com/?1uo8zd3ybgdmiwp[^] *Note: The above download has all the twitter keys for my account so you don't have to make a new account or anything. Please don't misuse it. Can you please add that feature that I want in the source?
Hey, Have you try'd settings the index of the new control?
FlowLayoutPanel1.Controls.SetChildIndex(Button1, 0)
Here button1 is my control as control and 0 (int) is the new index of the control in the flowlayoutpanel.
-
Hey, Have you try'd settings the index of the new control?
FlowLayoutPanel1.Controls.SetChildIndex(Button1, 0)
Here button1 is my control as control and 0 (int) is the new index of the control in the flowlayoutpanel.
Not quiet sure how that is done as I am new to controls and flowlayoutpanel. Here is the code that adds the tweets(items) into the control that I have made:
Private Sub AddTestTweet(ByVal tweet As TwitterStatus)
If (Me.FlowLayoutPanel1.InvokeRequired) Then
Me.FlowLayoutPanel1.Invoke(New AddTestTweetDelegate(AddressOf AddTestTweet), tweet)
Else
Console.WriteLine(String.Format("New tweet: @{0}: {1}", tweet.User.ScreenName, tweet.Text))
Me.FlowLayoutPanel1.Controls.Add(New TweetTimelineControl(tweet))End If End Sub
Private Sub NewTweet(ByVal tweet As TwitterStatus)
On Error Resume Next
AddTestTweet(tweet)
End SubAnd here is the control:
Public Class TweetTimelineControl
Public Sub New(ByVal status As TwitterStatus)
Me.InitializeComponent()Me.userPictureBox.LoadAsync(status.User.ProfileImageLocation) Me.UserNameLabel.Text = status.User.ScreenName Me.Label2.Text = status.CreatedDate.ToShortDateString() Me.DateLabel.Text = status.CreatedDate.ToShortTimeString() Me.TextLabel.Text = status.Text Me.Label1.Text = "Number Of Retweets: " & status.RetweetCountString End Sub
End Class
Can you please tell me how to do this on the code given above?
-
Not quiet sure how that is done as I am new to controls and flowlayoutpanel. Here is the code that adds the tweets(items) into the control that I have made:
Private Sub AddTestTweet(ByVal tweet As TwitterStatus)
If (Me.FlowLayoutPanel1.InvokeRequired) Then
Me.FlowLayoutPanel1.Invoke(New AddTestTweetDelegate(AddressOf AddTestTweet), tweet)
Else
Console.WriteLine(String.Format("New tweet: @{0}: {1}", tweet.User.ScreenName, tweet.Text))
Me.FlowLayoutPanel1.Controls.Add(New TweetTimelineControl(tweet))End If End Sub
Private Sub NewTweet(ByVal tweet As TwitterStatus)
On Error Resume Next
AddTestTweet(tweet)
End SubAnd here is the control:
Public Class TweetTimelineControl
Public Sub New(ByVal status As TwitterStatus)
Me.InitializeComponent()Me.userPictureBox.LoadAsync(status.User.ProfileImageLocation) Me.UserNameLabel.Text = status.User.ScreenName Me.Label2.Text = status.CreatedDate.ToShortDateString() Me.DateLabel.Text = status.CreatedDate.ToShortTimeString() Me.TextLabel.Text = status.Text Me.Label1.Text = "Number Of Retweets: " & status.RetweetCountString End Sub
End Class
Can you please tell me how to do this on the code given above?
Hey I gotte say i dont know your program so this is a bit of guessing. But from what you send i would suggest you place the code into your AddTestTweet sub.
Private Sub AddTestTweet(ByVal tweet As TwitterStatus)
If (Me.FlowLayoutPanel1.InvokeRequired) Then
Me.FlowLayoutPanel1.Invoke(New AddTestTweetDelegate(AddressOf AddTestTweet), tweet)
Else
Console.WriteLine(String.Format("New tweet: @{0}: {1}", tweet.User.ScreenName, tweet.Text))
Me.FlowLayoutPanel1.Controls.Add(New TweetTimelineControl(tweet))' Me.FlowLayoutPanel1.Controls.SetChildIndex(,)
End If
End Sub -
Hey I gotte say i dont know your program so this is a bit of guessing. But from what you send i would suggest you place the code into your AddTestTweet sub.
Private Sub AddTestTweet(ByVal tweet As TwitterStatus)
If (Me.FlowLayoutPanel1.InvokeRequired) Then
Me.FlowLayoutPanel1.Invoke(New AddTestTweetDelegate(AddressOf AddTestTweet), tweet)
Else
Console.WriteLine(String.Format("New tweet: @{0}: {1}", tweet.User.ScreenName, tweet.Text))
Me.FlowLayoutPanel1.Controls.Add(New TweetTimelineControl(tweet))' Me.FlowLayoutPanel1.Controls.SetChildIndex(,)
End If
End SubNope. Still don't get it. Here I have uploaded the entire source code: http://www.mediafire.com/?1uo8zd3ybgdmiwp[^] *Note: The above download has all the twitter keys for my account so you don't have to make a new account or anything. Please don't misuse it. Can you please add that feature that I want in the source?
-
Nope. Still don't get it. Here I have uploaded the entire source code: http://www.mediafire.com/?1uo8zd3ybgdmiwp[^] *Note: The above download has all the twitter keys for my account so you don't have to make a new account or anything. Please don't misuse it. Can you please add that feature that I want in the source?
I got the file, so you can remove the link if you want. Cant promise i can get to it ASAP, but i will see if i can paste in the code you need. EDIT: Oke got a quick look at it during work. the twitter is blocked here so i cant actually test it. but i think if you replace your AddTestTweet sub with this one it will work.
Private Sub AddTestTweet(ByVal tweet As TwitterStatus)
If (Me.FlowLayoutPanel1.InvokeRequired) Then
Me.FlowLayoutPanel1.Invoke(New AddTestTweetDelegate(AddressOf AddTestTweet), tweet)
Else
Console.WriteLine(String.Format("New tweet: @{0}: {1}", tweet.User.ScreenName, tweet.Text))Dim storedtweet As New TweetTimelineControl(tweet) Me.FlowLayoutPanel1.Controls.Add(storedtweet) Me.FlowLayoutPanel1.Controls.SetChildIndex(storedtweet, 0) End If End Sub
Like i said its untested so don't shoot me if it adds to the bottom, try playing with the 0 if this happends(make it FlowLayoutPanel1.Controls.Count for example).
-
I got the file, so you can remove the link if you want. Cant promise i can get to it ASAP, but i will see if i can paste in the code you need. EDIT: Oke got a quick look at it during work. the twitter is blocked here so i cant actually test it. but i think if you replace your AddTestTweet sub with this one it will work.
Private Sub AddTestTweet(ByVal tweet As TwitterStatus)
If (Me.FlowLayoutPanel1.InvokeRequired) Then
Me.FlowLayoutPanel1.Invoke(New AddTestTweetDelegate(AddressOf AddTestTweet), tweet)
Else
Console.WriteLine(String.Format("New tweet: @{0}: {1}", tweet.User.ScreenName, tweet.Text))Dim storedtweet As New TweetTimelineControl(tweet) Me.FlowLayoutPanel1.Controls.Add(storedtweet) Me.FlowLayoutPanel1.Controls.SetChildIndex(storedtweet, 0) End If End Sub
Like i said its untested so don't shoot me if it adds to the bottom, try playing with the 0 if this happends(make it FlowLayoutPanel1.Controls.Count for example).
Alright. Thanks.
-
Alright. Thanks.
Edited my last message with a possible solution.
-
Edited my last message with a possible solution.
That worked beautifully! :D Thanks m8!
-
That worked beautifully! :D Thanks m8!
no problem! glad to be of help (tough as it seems a formality here: remember to vote :cool:)
-
no problem! glad to be of help (tough as it seems a formality here: remember to vote :cool:)
Already done :D