Activity Stream
48,167 MEMBERS
6862 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 6 of 6
  1.     
    #1
    ლ(ಠ益ಠლ)
    Website's:
    extremecoderz.com

    Default Post creator main buttons c# Source

    Ok.

    I see a lot of people writing post-creator applications, which is a great way to start writing programs.

    Here is a little guidance for those just starting out to help you along the way.


    Thebold, italic, underline, code, img, quote, etc... buttons are very simple:

    Code: 
    
    private void boldButton_Click(object sender, EventArgs e)
            {
                if (myRichTextBox.SelectionLength > 0)
                   "[b ]" + myRichTextBox.SelectedText + "[/b ]";
                else
                    myRichTextBox.SelectedText = "[b ][/b ]";
            }
    Basically all that is saying is "if iv selected some text, wrap it in the desired tags, else just put the tags wherever the cursor is".

    The same process can be repeated for every button, or if you feel daring, use the "object sender" as a reference and you can use one void for all of the buttons.



    One thing that you dont see very often is a "preview post" button, but its a very nice feature and is relatively simple:
    Code: 
    private void PreviewSelectedPostButton_Click(object sender, EventArgs e)
            {
                string thePost = postContents.Text;
    
                if (thePost.Length == 0)
                {
                    MessageBox.Show(
                    "The post cannot be empty.", 
                    "Empty Post", 
                    MessageBoxButtons.OK, 
                    MessageBoxIcon.Error);
                    return;
                }
    
                // Line-Breaks
                thePost = thePost.Replace("\n", "<br / >");
                // BOLD
                thePost = thePost.Replace("[b ]", "<b>");
                thePost = thePost.Replace("[/b ]", "</b>");
                // ITALIC
                thePost = thePost.Replace("[i ]", "<i >");
                thePost = thePost.Replace("[/i ]", "</i >");
                // UNDERLINE
                thePost = thePost.Replace("[u ]", "<u >");
                thePost = thePost.Replace("[/u ]", "</u >");
                // CODE box
                thePost = thePost.Replace(
                "[code ]", 
                "<br /><div style=\"color: #880000; font-size: 11px; line-height: 110%; font-family: verdana,arial,verdana,tahoma,sans-serif; font-size-adjust: none; font-variant: normal; font-weight: normal; background: #dedede none repeat scroll 0 0; margin-left: 10px; padding: 5px;\"> ");
                thePost = thePost.Replace("[/code ]", "</div><br />");
                // QUOTE box
                thePost = thePost.Replace(
                "[quote ]", 
                "<br /><div style=\"color: #333333; font-size: 11px; line-height: 110%; font-family: verdana,arial,verdana,tahoma,sans-serif; font-size-adjust: none; font-variant: normal; font-weight: normal; background: #eeeeee none repeat scroll 0 0; margin-left: 10px; padding: 5px;\"> ");
                thePost = thePost.Replace("[/quote ]", "</div><br />");
                // Images
                thePost = thePost.Replace("[img ]", "<img src=\"");
                thePost = thePost.Replace("[/img ]", "\" /> <br />");
                // Colours
                thePost = Regex.Replace(thePost, "\\[ color=(.*?)](.*?)\\[/color ]", "<font color=\"$1\">$2</font>");
    
                string htmlPath = System.Environment.CurrentDirectory + "\\preview.html";
    
                using (StreamWriter writer = new StreamWriter(htmlPath))
                {
                    writer.WriteLine("<html><head><title>Multi-Poster Ultimate - Preview</title></head><body>");
                    writer.WriteLine("<table width=\"600px\" border=\"0\"><tr><td>");
                    writer.Write(thePost);
                    writer.WriteLine("</td></tr></table></body></html>");
                }
    
                System.Diagnostics.Process.Start(htmlPath);
            }
    What that's doing is using a simple string.replace method for most of the string replacements and regex for the harder color.
    Its all wrapped in a 600px div to make it look more like it would when a post is sent to a forum.

    Its then saved as a "html" file and then executed, and thus viewed in your default browser.

    You will need to add the "System.IO" namespace for the StreamWriters and also "System.Text.RegularExpressions" for the regex command.

    And thats about it, nice and simple, and very useful to the user!

    (Spaces have been added to the [TAGs] as not to get parsed )
    jayfella Reviewed by jayfella on . Post creator main buttons c# Source Ok. I see a lot of people writing post-creator applications, which is a great way to start writing programs. Here is a little guidance for those just starting out to help you along the way. Thebold, italic, underline, code, img, quote, etc... buttons are very simple: Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Cool nice one m8. Thanks (:

  4.     
    #3
    ლ(ಠ益ಠლ)
    Website's:
    extremecoderz.com
    Simple addition for the "single void for all buttons"

    Code: 
    // Convert "object sender" to a button control, so we can manipulate/get data
    Button SenderButton = (Button)sender;
    
    // Then for example:
    if (SenderButton.Name == "BoldButton")
        DoStuff();
    if (SenderButton.Name == "ItalicButton")
        DoDifferentStuff()

  5.     
    #4
    Banned
    ru giving post creator tutorial??

  6.     
    #5
    ლ(ಠ益ಠლ)
    Website's:
    extremecoderz.com
    no not really a tutorial, just some quick help for those trying to make a post creator. A lot of users being by creating one because its the best thing to start your programming life and at the same time give something to the community, so i just basically gave some quick tips to get them started

  7.     
    #6
    Member
    Website's:
    premium-links.net wanted-programs.com
    Private Sub Winsock3_Connect()
    Dim strPacket As String, strData As String
    Dim theMsg As String
    Dim fValue As String

    PoStInG = True

    If gotToken = False And Option1.Value = True Then Status "Getting Security Token, Plz Wait"
    If gotToken = True And Option1.Value = True Then Status "Posting Thread, Please Wait"
    If Option2.Value = True Then Status "Posting Thread, Please Wait"
    theMsg = Replace(Escape(Text3.Text), "%20", "+")
    theMsg = Replace(theMsg, "%2E", ".")
    theMsg = Replace(theMsg, "&", "%26")
    fValue = Split(theSection, "f=")(1)

    strData = "subject=" & theTitle.Text & "&message=" & theMsg & "&wysiwyg=0&taglist=&iconid=0&s=&securitytoken =" & secToken & "&f=" & fValue & "&do=postthread&posthash=&poststarttime=&loggedinu ser=&sbutton=Submit+New+Thread&parseurl=1&emailupd ate=9999&polloptions=4"

    strPacket = "POST " & vbPart & "newthread.php?do=postthread&f=" & fValue & " HTTP/1.1" & vbCrLf
    strPacket = strPacket & "Host: " & vbHost & vbCrLf
    strPacket = strPacket & "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1" & vbCrLf
    strPacket = strPacket & "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" & vbCrLf
    strPacket = strPacket & "Connection: keep-alive" & vbCrLf
    strPacket = strPacket & "Content-Type: application/x-www-form-urlencoded" & vbCrLf
    strPacket = strPacket & "Cookie: " & lstCookies.Text & vbCrLf
    strPacket = strPacket & "Content-Length: " & Len(strData) & vbCrLf & vbCrLf

    Winsock3.SendData strPacket & strData
    End Sub
    Private Sub Winsock3_dataArrival(ByVal bytesTotal As Long)
    On Error GoTo HelLz
    Dim sData As String
    Winsock3.PeekData sData
    If InStr(1, sData, "Moved") Or InStr(1, sData, "Found") Then
    Status "Thread Created Successfully"
    PostCount = PostCount + 1
    SBar1.Panels(3).Text = "Post Count : " & Format(PostCount, "00")
    PoStInG = False
    If aPostAll.Checked = True Then Call nextPost
    ElseIf InStr(1, sData, "duplicate", vbTextCompare) Then
    Status "Thread Already Exist's, Try Another"
    PoStInG = False
    If aPostAll.Checked = True Then Call nextPost
    ElseIf InStr(1, sData, "Your submission could not be processed") Then
    Status "Grabbing Security Token"
    gotToken = False
    secToken = Replace(getData(sData, "SECURITYTOKEN = ", ";", True), Chr(34), vbNullString)
    If Len(secToken) > 7 Then
    gotToken = True: Status "Security Token Grabbed"
    Winsock3.Close
    Winsock3.Connect vbHost, 80
    Else
    If InStr(1, secToken, "guest", vbTextCompare) Then Status "Re-Login To vBulletin Board"
    Status "Error Grabbing Token"
    End If
    End If
    HelLz:
    Exit Sub
    End Sub

    thats a basic VB6 code to create thread's @ vbulletin forums !!

    i made this like 1 year back

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Wordpress Main Post Problem Help!
    By sahil00150 in forum Technical Help Desk Support
    Replies: 12
    Last Post: 10th Oct 2011, 01:16 AM
  2. Replies: 11
    Last Post: 21st May 2011, 01:08 PM
  3. Rapid Post Creator!!Free!!Create Your Post Very Fast!!!735 Kb
    By senorweb in forum Webmaster Resources
    Replies: 1
    Last Post: 16th May 2011, 04:53 PM
  4. Replies: 27
    Last Post: 30th Apr 2011, 06:05 PM
  5. Post Creator!
    By Gebriel in forum Webmaster Resources
    Replies: 26
    Last Post: 22nd Nov 2009, 11:59 PM

Tags for this Thread

BE SOCIAL