artemix22's Profile User Rating: -----

Reputation: 13 Tradesman
Group:
Active Members
Active Posts:
130 (0.16 per day)
Joined:
21-January 12
Profile Views:
3,143
Last Active:
User is offline Apr 16 2014 06:30 AM
Currently:
Offline

Previous Fields

Country:
ID
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Volkswagen
Dream Kudos:
0

Latest Visitors

Icon   artemix22 has not set their status

Posts I've Made

  1. In Topic: parameter string too long when replace text to word document

    Posted 16 Apr 2014

    never mind, already solved
  2. In Topic: parameter string too long when replace text to word document

    Posted 15 Apr 2014

    i am ashamed to ask again, but after trying to solve this by myself and fail, i have no choice but asking to you guys, here the new problem with replace with code above :

    i have to replace 3 richtextboxes to a word document at a time, the problem is, with code above i just can replace the last richtextbox :

    ReplaceTextInWordDoc("wordtofind1", RichTextBox1.Text, objWordApp)
    ReplaceTextInWordDoc("wordtofind2", RichTextBox2.Text, objWordApp)
    ReplaceTextInWordDoc("wordtofind3", RichTextBox3.Text, objWordApp) 'I CAN ONLY REPLACE THIS ONE
    
    


    how to fix this?

    thanks in advance.
  3. In Topic: parameter string too long when replace text to word document

    Posted 14 Apr 2014

    thanks andrew for your search, problem solve, sorry for not searching before, here is the working code :

    Public Shared Sub ReplaceTextInWordDoc(ByVal findMe As [Object], ByVal replaceMe As [Object], ByVal app As Microsoft.Office.Interop.Word.Application)
            Try
                Dim replaceAll As Object = Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll
                Dim missing As Object = System.Reflection.Missing.Value
                app.Application.Selection.Find.ClearFormatting()
                app.Application.Selection.Find.Text = DirectCast(findMe, String)
                app.Application.Selection.Find.Replacement.ClearFormatting()
    
                If replaceMe.ToString().Length < 250 Then
                    ' Normal execution
                    app.Application.Selection.Find.Replacement.Text = DirectCast(replaceMe, String)
                    app.Application.Selection.Find.Execute(missing, missing, missing, missing, missing, missing, _
                     missing, missing, missing, missing, replaceAll, missing, _
                     missing, missing, missing)
                Else
                    ' Some real simple logic!!
                    app.Application.Selection.Find.Execute(findMe, missing, missing, missing, missing, missing, _
                     missing, missing, missing, missing, missing, missing, _
                     missing, missing, missing)
                    ' the area where the findMe is located in the Document is selected.
                    ' Hence when you execute the statement below the replaceMe string is
                    ' placed in the area selected, which is what we wanted!
                    app.Application.Selection.Text = DirectCast(replaceMe, String)
                End If
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Sub
    
    
  4. In Topic: User login authenticated by an access database

    Posted 25 May 2013

    u can simple use DataReader to make an authentication (i think DataAdapter was too much), first check for username, if valid then check the password, just that simple, here is an example :

    'CHECK THE USERNAME
    Dim command As New OleDbCommand("SELECT username FROM your_table WHERE username = @username", conn)
       command.Parameters.AddWithValue("@username", your_username_textbox.Text)
       Dim reader As OleDbDataReader
       reader = command.ExecuteReader
          If reader.HasRows = False Then
             MsgBox("your username was not right or you might be not register yet")
             reader.Close()
             command.Dispose()
          Else
    'IF USERNAME WAS VALID THEN GO TO PASSWORD
             reader.Close()
             Dim command2 As New OleDbCommand("SELECT * FROM your_table WHERE username = @username;", conn)
             command2.Parameters.AddWithValue("@username", your_username_textbox.Text)
             Dim reader2 As OleDbDataReader
             reader2 = command2.ExecuteReader
             If reader2.Read() Then
                If reader2(your_password_INDEX_field_in_database).ToString <> your_password_textbox.Text Then
                   MsgBox("your password was not right, please try again")
                Else
                   'DO WHAT EVER YOU WANT HERE IF USERNAME AND PASSWORD WAS AUTHENTICATED
                End If
             End If
             reader2.Close()
             command2.Dispose()
          End If
    
    


    PS : "conn" should be your connection string
  5. In Topic: Please answer my question.

    Posted 31 Jan 2013

    it's strange, how it will run if it doesn't exist?

My Information

Member Title:
D.I.C Head
Age:
31 years old
Birthday:
June 22, 1982
Gender:
Location:
East Borneo
Full Name:
Firmana I. Zery

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

Page 1 of 1
  1. Photo

    lucky3 Icon

    09 Oct 2012 - 01:39
    Hey there. I just wanted to respond to your "Thank you" topic, while I'm on my coffee break, but it seems to be deleted. Anyway, I'm happy it worked for you. Good luck!
Page 1 of 1