Circuit Negma

C++, C, VB.NET, PCB, Electronics, Circuit Design

Archive for May, 2006

Register/Unregister Active X Components from the Context Menu

Posted by Circuit Negma on May 27, 2006


Register/Unregister Active X Components from the Context Menu
Author: Greg
Category: Registry
Type: Snippets
Difficulty: Intermediate
Version Compatibility:  Visual Basic 5   Visual Basic 6

More information: Copy/Paste the below into notepad and save it as “something.reg”. Run it and you’ll be able to registre/unregister ocxs and dlls with the context menu (i.e., by right clicking on the file in windows explorer).

This code has been viewed 47310 times.

Instructions: Copy the declarations and code below and paste directly into your VB project.

_____________________________________________________________________________________________

REGEDIT4

;  This adds the ability to Right-Click on a .dll or .ocx
;  and get the Register / <b style=”color:black;background-color:#a0ffff”>UnRegister</b> options.

; ==========
; .DLL files
; ==========

[HKEY_CLASSES_ROOT\.dll]
“Content Type”=”application/<b style=”color:black;background-color:#ff9999″>x</b>-msdownload”
@=”dllfile”

[HKEY_CLASSES_ROOT\dllfile]
@=”Application Extension”

[HKEY_CLASSES_ROOT\dllfile\Shell\Register\command]
@=”regsvr32.exe \”%1\””

[HKEY_CLASSES_ROOT\dllfile\Shell\<b style=”color:black;background-color:#a0ffff”>UnRegister</b>\command]
@=”regsvr32.exe /u \”%1\””

; ==========
; .OCX files
; ==========

[HKEY_CLASSES_ROOT\.ocx]
@=”ocxfile”

[HKEY_CLASSES_ROOT\ocxfile]
@=”OCX”

[HKEY_CLASSES_ROOT\ocxfile\Shell\Register\command]
@=”regsvr32.exe \”%1\””

[HKEY_CLASSES_ROOT\ocxfile\Shell\<b style=”color:black;background-color:#a0ffff”>UnRegister</b>\command]
@=”regsvr32.exe /u \”%1\””

; End

Advertisements

Posted in Uncategorized | 6 Comments »

UpDate: Opt-Out Letter Generator – Ver. 2.0.0.7

Posted by Circuit Negma on May 26, 2006


Testing is done on XP Pro Machine

Software Testing:

1. Test the software on other machines with Installed Office Products DONE

Results:

1. If the computer does not have .NET Framework 2.0, opt-out letter generator will download framework from microsoft.com automatically.

2. Since I am using the .NET Packager (Installer), the user will not be able to define where to install the software.

3. The only bug in the software – as far as I can determined – is that if the saved file is open and the user try to re-save the file, the software will indicate some illegal operation. JUST IGNORE THE WARNING

4. There is Uninstaller included with the software. To uninstall the software just add/remove from the control panel

2. Test the software on other machines with no Installed Office Products DONE

Results:

1. If the computer does not have .NET Framework 2.0, opt-out letter generator will download framework from microsoft.com automatically.

2. Since I am using the .NET Packager (Installer), the user will not be able to define where to install the software.

3. The only bug in the software – as far as I can determined – is that if the saved file is open and the user try to re-save the file, the software will indicate some illegal operation. JUST IGNORE THE WARNING

4. There is Uninstaller included. To uninstall the software just add/remove from the control panel

5. The one feature that generates a Word document is not going to work, MS WORD must be installed on the machine. the other feature is that the software can generate a TEXT File which is a good thing for users with no MS OFFICE PRODUCTS

Download-Link: http://rapidshare.de/files/21392830/Opt-Out_2_0_0_7.zip.html

Posted in VB.NET | 3 Comments »

How to USE SAVE DIALOG BOX and OPEN DIALOG BOX:

Posted by Circuit Negma on May 25, 2006


Download Tutorial- PDF File:http://rapidshare.de/files/21379540/SaveFileDialog.pdf.html

Step-By-Step Instructions:

1. From ToolBox ——> Select “Dialogs” Category ——> Click on “SaveFileDialog”

2. In the Properties Window ———> Change the “SaveFileDialog1” to “SaveFileDialog” under (Name)

3. Read the Following Function:

Private Sub SaveFileName(ByVal extStr As String, ByVal ExtNameStr As String)

Dim filename As String

On Error GoTo SaveAsErr

' display the Save dialog

SaveFileDialog.AddExtension = True ‘ This is one of Dialog Properties

SaveFileDialog.DefaultExt = extStr ‘ This is one of Dialog Properties: Ex: { jpg or pdf or doc}

SaveFileDialog.Filter = ExtNameStr + " (*." + extStr + ")|*." + extStr ‘ This is one of Dialog Properties

' Check if yes or Cancel btn is clicked

' get the resulting filename

If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.Cancel Then

If extStr = "doc" Thenhttps://i2.wp.com/img101.imagevenue.com/aAfkjfp01fo1i-13575/loc184/86776_SaveFileDialog.jpg

filename = "opt-out." + extStr

ElseIf extStr = "txt" Then

filename = "opt-out." + extStr

End If

Else

filename = SaveFileDialog.FileName

End If

SaveAsErr:

Exit Sub

End Sub

Posted in VB.NET | 16 Comments »

UpDate: Opt-Out Letter Generator – Ver. 2.0.0.6

Posted by Circuit Negma on May 25, 2006


TESTING:

1. Test the software on other machines with Installed Office Products DONE

2. Test the software on other machines with no Installed Office Products NOT DONE

 

 

Added Features:

1. Notification Menu Strip beside the Clock       DONE

2. BackGround Image                                        DONE

 

 

Software Bugs:

1. Control the font format within cells                DONE

2. Check user input syntax and characteristics DONE

3. Check if the file exists                                    DONE

4. Check if the file is already opened                 NOT DONE

https://i1.wp.com/cdn-30.cdn.buzznet.com/assets/users11/subspace/default/msg-114858225565-2.jpg

Download-Link: http://rapidshare.de/files/21371773/Opt-Out_2_0_0_6.zip.html

Posted in VB.NET | Leave a Comment »

UpDate: Opt-Out Letter Generator – Ver. 2.0.0.5

Posted by Circuit Negma on May 25, 2006


Software Bugs:
1. Control the font format within cells                    DONE
2. Check user input syntax and characteristics     DONE
3. Check if the file exists                                        DONE 
4. check if the file is already opened                     NOT DONE
 
https://i0.wp.com/cdn-99.cdn.buzznet.com/assets/users11/subspace/default/msg-114848806472-2.jpg
https://i1.wp.com/cdn-27.cdn.buzznet.com/assets/users11/subspace/default/msg-114848806186-2.jpg
 

Posted in VB.NET | Leave a Comment »

UpDate: Opt-Out Letter Generator – Ver. 2.0

Posted by Circuit Negma on May 24, 2006


Software Bugs:
1. Control the font format within cells                    DONE
2. Check user input syntax and characteristics     DONE
3. Check if the file exists                                        NOT DONE
4. check if the file is already opened                     NOT DONE

https://i0.wp.com/cdn-99.cdn.buzznet.com/assets/users11/subspace/default/msg-114848806472-2.jpg

https://i1.wp.com/cdn-27.cdn.buzznet.com/assets/users11/subspace/default/msg-114848806186-2.jpg

G:\Documents and Settings\nemo\My Documents\Visual Studio 2005\Projects\Opt-Out\Opt-Out\MainForm.vb 1

1 Option Explicit On

23

Public Class MainForm

45

Private filename As String

6 Private astr As String

7 Private Saveflag As Boolean

8 Private MyWord As Word.Application

9 Private WordDoc As Word.Document

10 Private MyTable As Word.Table

11 Private MyCell As Word.Cell

12 Private MyCols As Word.Columns

13 Private RetSt As String

14 Private i, ro, co, addressflag As Integer

15 Private currdate As Date

16

17

18 Private Sub clearBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearBtn.Click

19

20 frstTxtBox.Text = “”

21 frstTxtBox.BackColor = Color.White

22 midTxtBox.Text = “”

23 midTxtBox.BackColor = Color.White

24 lstTxtBox.Text = “”

25 lstTxtBox.BackColor = Color.White

26 currTxtBox.Text = “”

27 currTxtBox.BackColor = Color.White

28 prevTxtBox.Text = “(Fill in your previous mailing address if you have moved in the last 6 months.) Note: not required by


Equifax and Experian.”

29 prevTxtBox.BackColor = Color.White

30 ssnTxtBox.Text = “333224444 – No Dashes”

31 ssnTxtBox.BackColor = Color.White

32

33 End Sub

34

35 Private Sub exitBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitBtn.Click

36 Dispose()

37

38 End Sub

39

40 Private Sub okBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles okBtn.Click

41

42 ‘ String Error Check Data

43 ‘============================

44 If strErrorCheck() = 1 Then

45 Exit Sub

46 End If

47

48 If ssnErrorCheck() = 1 Then

49 Exit Sub

50 End If

51

52 Me.WindowState = FormWindowState.Minimized

53 Me.Enabled = False

54 progressFrm.Show()

55

G:\Documents and Settings\nemo\My Documents\Visual Studio 2005\Projects\Opt-Out\Opt-Out\MainForm.vb 2

56 If RadioButton1.Checked = True Then

57

58 Call SaveFileName(“doc”, “MS Word Documents”) ‘ Call Save File Dialog to save the output results

59

60 MyWord = CreateObject(“Word.Application”)

61 WordDoc = MyWord.Documents.Add

62

63 MyWord.Visible = True

64

65 Call AddressChange(1)

66 MyWord.Selection.InsertBreak()

67 Call AddressChange(2)

68 MyWord.Selection.InsertBreak()

69 Call AddressChange(3)

70

71 ‘=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

72

73 ‘finaly save the file. If the document exists then will be overwriten

74 WordDoc.SaveAs(filename)

75

76 WordDoc.Application.Quit()

77

78 WordDoc = Nothing

79 MyWord = Nothing

80

81 progressFrm.Button1.Text = “Process is Done”

82

83 ElseIf RadioButton2.Checked = True Then

84

85 Call SaveFileName(“txt”, “Text Documents”) ‘ Call Save File Dialog to save the output results

86

87 End If

88

89 End Sub

90

91 ‘ Save Dailog Method

92 ‘=======================

93 #Region “Save Dailog Method”

94 Private Sub SaveFileName(ByVal str1 As String, ByVal str2 As String)

95

96 On Error GoTo SaveAsErr

97

98 ‘ display the Save dialog

99 SaveFileDialog.AddExtension = True

100 SaveFileDialog.DefaultExt = str1

101 SaveFileDialog.Filter = str2 + ” (*.” + str1 + “)|*.” + str1

102

103 ‘ Check if yes or Cancel btn is clicked

104 ‘ get the resulting filename

105 If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.Cancel Then

106 filename = “opt-out.” + str1

107 Else

108 filename = SaveFileDialog.FileName

109 End If

110

111 SaveAsErr:

G:\Documents and Settings\nemo\My Documents\Visual Studio 2005\Projects\Opt-Out\Opt-Out\MainForm.vb 3

112 Exit Sub

113

114 End Sub

115 #End Region

116

117 ‘ Main Code to Generate the Output Results

118 ‘===============================================

119 #Region “Main Code to Generate the Output Results”

120 Private Sub AddressChange(ByVal flag As Integer)

121

122 Dim RetSt As String

123

124 RetSt = Chr(13)

125

126 MyWord.Selection.Font.Name = “Times New Roman”

127 MyWord.Selection.Font.Size = 12

128 MyWord.Selection.Font.Bold = False

129 MyWord.Selection.Font.Underline = Word.WdUnderline.wdUnderlineNone

130 MyWord.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft

131

132 Select Case flag

133 Case 1

134 astr = “Equifax, Inc.” + RetSt + “P.O. Box 740123” + RetSt + “Atlanta, GA 30374-0123”

135 Case 2

136 astr = “Experian” + RetSt + “Consumer Opt-Out” + RetSt + “701 Experian Parkway” + RetSt + “Allen, TX 75013”

137 Case 3

138 astr = “Trans Union Corporation’s” + RetSt + “Name Removal Option” + RetSt + “P.O. Box 97328” + RetSt + “Jackson,


MS 39288-7328″

139 End Select

140

141 MyWord.Selection.TypeText(astr)

142

143 For i = 1 To 2

 

144 MyWord.Selection.TypeText(RetSt)

145 Next i

146

147 astr = frstTxtBox.Text + ” ” + lstTxtBox.Text + RetSt + currTxtBox.Text + RetSt

148 MyWord.Selection.TypeText(astr)

149

150 For i = 1 To 2 : MyWord.Selection.TypeText(RetSt) : Next i

151

152 currdate = Date.Now

153

154 astr = “Date: ” + currdate + RetSt

155 MyWord.Selection.TypeText(astr)

156

157 For i = 1 To 2 : MyWord.Selection.TypeText(RetSt) : Next i

158

159 astr = “To whom it may concern: ” + RetSt

160 MyWord.Selection.TypeText(astr)

161

162 For i = 1 To 2 : MyWord.Selection.TypeText(RetSt) : Next i

163

164 astr = “I request to have my name removed from your marketing lists. Here is the information you have asked me to include


in my request:” + RetSt

165 MyWord.Selection.TypeText(astr)

G:\Documents and Settings\nemo\My Documents\Visual Studio 2005\Projects\Opt-Out\Opt-Out\MainForm.vb 4

166

167 For i = 1 To 2 : MyWord.Selection.TypeText(RetSt) : Next i

168

169 MyWord.Selection.Font.Size = 11

170

171

172 ‘ Fill out the table

173 ‘=========================

174

175 ro = 6 ‘Numbers of rows

176 co = 2 ‘Numbers of columns

177 MyTable = MyWord.Selection.Tables.Add(MyWord.Selection.Range, ro, co)

178 MyCols = MyTable.Columns

179 MyCols(1).Width = 250

180 MyCols(2).Width = 250

181

182 ‘ Cell (1, 1)

183 MyCell = MyTable.Cell(1, 1)

184 MyCell.Select()

185 MyCell.Split(2)

186 MyWord.Selection.Font.Bold = True

187 MyWord.Selection.TypeText(“FIRST, MIDDLE & LAST NAME”)

188

189 ‘ Cell (2, 1)

190 MyCell = MyTable.Cell(2, 1)

191 MyCell.Select()

192 MyWord.Selection.Font.Bold = False

193 MyWord.Selection.Font.Italic = True

194 MyWord.Selection.TypeText(“(List all name variations, including Jr., Sr., etc.)”)

195

 

196 ‘ Cell (1, 2)

197 MyCell = MyTable.Cell(1, 2)

198 MyCell.Select()

199 MyWord.Selection.TypeText(frstTxtBox.Text + ” ” + midTxtBox.Text + ” ” + lstTxtBox.Text)

200

201 ‘————————————————————————————–

202 ‘ Cell (3, 1)

203 MyCell = MyTable.Cell(3, 1)

204 MyCell.Select()

205 MyWord.Selection.Font.Bold = True

206 MyWord.Selection.TypeText(“CURRENT MAILING ADDRESS”)

207

208 ‘ Cell (3, 2)

209 MyCell = MyTable.Cell(3, 2)

210 MyCell.Select()

211 MyWord.Selection.TypeText(currTxtBox.Text)

212

213 ‘—————————————————————————————

214 ‘ Cell (4, 1)

215 MyCell = MyTable.Cell(4, 1)

216 MyCell.Select()

217 MyCell.Split(2)

218 MyWord.Selection.Font.Bold = True

219 MyWord.Selection.TypeText(“PREVIOUS MAILING ADDRESS”)

220

221 ‘ Cell (5, 1)

G:\Documents and Settings\nemo\My Documents\Visual Studio 2005\Projects\Opt-Out\Opt-Out\MainForm.vb 5

222 MyCell = MyTable.Cell(5, 1)

223 MyCell.Select()

224 MyWord.Selection.Font.Italic = True

225 MyWord.Selection.Font.Bold = False

226 MyWord.Selection.TypeText(“(Fill in your previous mailing address if you have moved in the last 6 months.)” + RetSt +

“Note: not required by Equifax and Experian.”)

227

228 If flag = 3 Then

229 MyCell = MyTable.Cell(4, 2)

230 MyCell.Select()

231 MyWord.Selection.TypeText(prevTxtBox.Text)

232 Else

233 MyCell = MyTable.Cell(4, 2)

234 MyCell.Select()

235 MyWord.Selection.TypeText(“”)

236 End If

237

238 ‘ Cell (6, 1)

239 MyCell = MyTable.Cell(6, 1)

240 MyCell.Select()

241 MyCell.Split(2)

242 MyWord.Selection.Font.Bold = True

243 MyWord.Selection.TypeText(“SOCIAL SECURITY NUMBER”)

244

245 ‘ Cell (7, 1)

246 MyCell = MyTable.Cell(7, 1)

247 MyCell.Select()

248 MyWord.Selection.Font.Bold = False

249 MyWord.Selection.Font.Italic = True

250 MyWord.Selection.TypeText(“Note: not required by Experian.”)

251

252 If flag = 1 Or flag = 3 Then

253 MyCell = MyTable.Cell(6, 2) : MyCell.Select() : MyWord.Selection.TypeText(ssnTxtBox.Text)

254 Else

255 MyCell = MyTable.Cell(6, 2) : MyCell.Select() : MyWord.Selection.TypeText(“”)

256 End If

257

258 ‘ Cell (8, 1)

259 MyCell = MyTable.Cell(8, 1)

260 MyCell.Select()

261 MyCell.Split(2)

262 MyWord.Selection.Font.Bold = True

263 MyWord.Selection.TypeText(“DATE OF BIRTH”)

264

265 ‘ Cell (9, 1)

266 MyCell = MyTable.Cell(9, 1)

267 MyCell.Select()

268 MyWord.Selection.Font.Bold = False

269 MyWord.Selection.Font.Italic = True

270 MyWord.Selection.TypeText(“Note: not required by Equifax and Experian.”)

271

272 If flag = 3 Then

273 MyCell = MyTable.Cell(8, 2) : MyCell.Select() : MyWord.Selection.TypeText(DateTimePicker.Value.ToShortDateString)

274 Else

275 MyCell = MyTable.Cell(8, 2) : MyCell.Select() : MyWord.Selection.TypeText(“”)

276 End If

G:\Documents and Settings\nemo\My Documents\Visual Studio 2005\Projects\Opt-Out\Opt-Out\MainForm.vb 6

277

278 ‘Exit from table

279 MyCell = MyTable.Cell(10, 2) : MyCell.Select()

280 MyCell = Nothing

281 MyWord.Selection.GoToNext(Word.WdGoToItem.wdGoToLine)

282

283 For i = 1 To 3 : MyWord.Selection.TypeText(RetSt) : Next i

284

285 MyWord.Selection.Font.Size = 12

286

287 MyWord.Selection.TypeText(“Thank you for your prompt handling of my request.”)

288

289 For i = 1 To 3 : MyWord.Selection.TypeText(RetSt) : Next i

290

291 MyWord.Selection.TypeText(“_______________________________”)

292 MyWord.Selection.TypeText(RetSt)

293 MyWord.Selection.Font.Bold = True

294 MyWord.Selection.Font.Size = 10

295 MyWord.Selection.TypeText(“SIGNATURE of ” + frstTxtBox.Text + ” ” + lstTxtBox.Text)

296

297

298 End Sub

299 #End Region

300

301 ‘ Mouse Clicked Events

302 ‘=========================

303 #Region “Mouse Clicked Methods”

304 Private Sub frstTxtBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles frstTxtBox.

MouseClick

305

306 frstTxtBox.Text = “”

307 frstTxtBox.BackColor = Color.White

308

309 End Sub

310

311 Private Sub midTxtBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles midTxtBox.

MouseClick

312

313 midTxtBox.Text = “”

314 midTxtBox.BackColor = Color.White

315

316 End Sub

317

318 Private Sub lstTxtBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstTxtBox.

MouseClick

319

320 lstTxtBox.Text = “”

321 lstTxtBox.BackColor = Color.White

322

323 End Sub

324

325 Private Sub currTxtBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles currTxtBox.

MouseClick

326

327 currTxtBox.Text = “”

328 currTxtBox.BackColor = Color.White

G:\Documents and Settings\nemo\My Documents\Visual Studio 2005\Projects\Opt-Out\Opt-Out\MainForm.vb 7

329

330 End Sub

331

332 Private Sub prevTxtBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles prevTxtBox.

MouseClick

333

334 prevTxtBox.Text = “”

335 prevTxtBox.BackColor = Color.White

336

337 End Sub

338

339 Private Sub ssnTxtBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ssnTxtBox.

MouseClick

340

341 ssnTxtBox.Text = “”

342 ssnTxtBox.BackColor = Color.White

343

344 End Sub

345

346 #End Region

347

348 End Class

349

____________________________________________________________________________________________________

====================================================================================================

G:\Documents and Settings\nemo\My Documents\Visual Studio 2005\Projects\Opt-Out\Opt-Out\ErrorCheck.vb 1

1 Module ErrorCheck

23

#Region “String Error Check”

4 Public Function strErrorCheck() As Integer

56

If MainForm.frstTxtBox.Text = “” Then

7 MsgBox(“Please, Enter your First Name”, vbCritical)

8 MainForm.frstTxtBox.BackColor = Color.Yellow

9 strErrorCheck = 1

10 Exit Function

11 End If

12

13 If MainForm.midTxtBox.Text = “” Then

14 MsgBox(“Please, Enter your Middle Name or select the middle Name Text Field and then press the spaceBar”, vbCritical)

15 MainForm.midTxtBox.BackColor = Color.Yellow

16 strErrorCheck = 1

17 Exit Function

18 End If

19

20 If MainForm.lstTxtBox.Text = “” Then

21 MsgBox(“Please, Enter your Last Name”, vbCritical)

22 MainForm.lstTxtBox.BackColor = Color.Yellow

23 strErrorCheck = 1

24 Exit Function

25 End If

26

27 If MainForm.currTxtBox.Text = “” Then

28 MsgBox(“Please, Enter your Current Address”, vbCritical)

29 MainForm.currTxtBox.BackColor = Color.Yellow

30 strErrorCheck = 1

31 Exit Function

32 End If

33

34 If MainForm.prevTxtBox.Text = “” Then

35 MsgBox(“Please, Enter your Previous Address or select Previous Address Text Field and then press the spaceBar”,

vbCritical)

36 MainForm.prevTxtBox.BackColor = Color.Yellow

37 strErrorCheck = 1

38 Exit Function

39 End If

40

41 End Function

42

43 #End Region

44

45 #Region “SSN Error Check”

46 Public Function ssnErrorCheck() As Integer

47

48 Dim iLength As Integer

49 Dim ssnStr As String

50 Dim str As String

51

52

53 iLength = Trim(MainForm.ssnTxtBox.Text).Length()

54

55 If Not IsNumeric(MainForm.ssnTxtBox.Text) Then

G:\Documents and Settings\nemo\My Documents\Visual Studio 2005\Projects\Opt-Out\Opt-Out\ErrorCheck.vb 2

56 MsgBox(“Please, Enter a 9 Digits SSN”, MsgBoxStyle.Critical)

57 MainForm.ssnTxtBox.BackColor = Color.Yellow

58 ssnErrorCheck = 1

59 Exit Function

60 End If

61

62 If Not (iLength = 9) Then

63 MsgBox(“Please, Enter a 9 Digits SSN”, MsgBoxStyle.Critical)

64 MainForm.ssnTxtBox.BackColor = Color.Yellow

65 ssnErrorCheck = 1

66 Exit Function

67 End If

68

69 str = Trim(MainForm.ssnTxtBox.Text)

70 ssnStr = Mid(str, 1, 3) + “-” + Mid(str, 4, 2) + “-” + Mid(str, 6, 4)

71 MainForm.ssnTxtBox.Text = ssnStr

72

73 End Function

74

75 #End Region

76

77 End Module

78

Posted in VB.NET | Leave a Comment »

Opt-Out Letter Generator

Posted by Circuit Negma on May 24, 2006


I have designed a program that will generate the following sample letter for all three credit bureaus.

Credit Bureaus: Sample Opt-Out Letter

Be sure to send your letter to ALL three credit bureaus.

Options
Equifax, Inc.
P.O. Box 740123
Atlanta, GA 30374-0123
Experian
Consumer Opt-Out
701 Experian Parkway
Allen, TX 75013
Trans Union Corporation’s
Name Removal Option
P.O. Box 97328
Jackson, MS 39288-7328


Date  

To whom it may concern:

I request to have my name removed from your marketing lists. Here is the information you have asked me to include in my request:

FIRST, MIDDLE & LAST NAME
(List all name variations, including Jr., Sr., etc.)

______________________________
______________________________

CURRENT MAILING ADDRESS

______________________________
______________________________
______________________________
______________________________

PREVIOUS MAILING ADDRESS
(Fill in your previous mailing address
if you have moved in the last 6 months.)
Note: not required by Equifax and Experian.

______________________________
______________________________
______________________________
______________________________

SOCIAL SECURITY NUMBER
Note: not required by Experian.

______________________________

DATE OF BIRTH
Note: not required by Equifax and Experian.

______________________________

 

Thank you for your prompt handling of my request.

 

_____________________________________
 SIGNATURE

 

Software Bugs:
1. Control the font format within cells
2. Check user input syntax and characteristics
3. Check if the file exists
4. check if the file is already opened
 
https://i0.wp.com/cdn-41.cdn.buzznet.com/assets/users11/subspace/default/msg-114843428257-2.jpg

MainFrame.vb:

=======================

Option Explicit On

Public Class MainForm

Private filename As String

Private astr As String

Private Saveflag As Boolean

Private MyWord As Word.Application

Private WordDoc As Word.Document

Private MyTable As Word.Table

Private MyCell As Word.Cell

Private MyCols As Word.Columns

Private RetSt As String

Private i, ro, co, addressflag As Integer

Private currdate As Date

 

Private Sub clearBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearBtn.Click

frstTxtBox.Text = “”

midTxtBox.Text = “”

lstTxtBox.Text = “”

currTxtBox.Text = “”

prevTxtBox.Text = “”

ssnTxtBox.Text = “”

‘birthTxtBox.Text = “”

End Sub

Private Sub exitBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitBtn.Click

Dispose()

End Sub

Private Sub okBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles okBtn.Click

 

‘\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

If RadioButton1.Checked = True Then

Me.WindowState = FormWindowState.Minimized

Me.Enabled = False

Call SaveFileName(“doc”, “MS Word Documents”) ‘ Call Save File Dialog to save the output results

progressFrm.Show()

MyWord = CreateObject(“Word.Application”)

WordDoc = MyWord.Documents.Add

MyWord.Visible = True

Call AddressChange(1)

MyWord.Selection.InsertBreak()

Call AddressChange(2)

MyWord.Selection.InsertBreak()

Call AddressChange(3)

‘=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

‘finaly save the file. If the document exists then will be overwriten

WordDoc.SaveAs(filename)

WordDoc.Application.Quit()

WordDoc = Nothing

MyWord = Nothing

progressFrm.Button1.Text = “Process is Done”

ElseIf RadioButton2.Checked = True Then

Call SaveFileName(“txt”, “Text Documents”) ‘ Call Save File Dialog to save the output results

End If

End Sub

Private Sub SaveFileName(ByVal str1 As String, ByVal str2 As String)

On Error GoTo SaveAsErr

‘ display the Save dialog

SaveFileDialog.AddExtension = True

SaveFileDialog.DefaultExt = str1

SaveFileDialog.Filter = str2 + ” (*.” + str1 + “)|*.” + str1

‘ Check if yes or Cancel btn is clicked

‘ get the resulting filename

If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.Cancel Then

filename = “opt-out.” + str1

Else

filename = SaveFileDialog.FileName

End If

SaveAsErr:

Exit Sub

End Sub

Private Sub AddressChange(ByVal flag As Integer)

Dim RetSt As String

RetSt = Chr(13)

MyWord.Selection.Font.Name = “Times New Roman”

MyWord.Selection.Font.Size = 12

MyWord.Selection.Font.Bold = False

MyWord.Selection.Font.Underline = Word.WdUnderline.wdUnderlineNone

MyWord.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft

Select Case flag

Case 1

astr = “Equifax, Inc.” + RetSt + “P.O. Box 740123” + RetSt + “Atlanta, GA 30374-0123”

Case 2

astr = “Experian” + RetSt + “Consumer Opt-Out” + RetSt + “701 Experian Parkway” + RetSt + “Allen, TX 75013”

Case 3

astr = “Trans Union Corporation’s” + RetSt + “Name Removal Option” + RetSt + “P.O. Box 97328” + RetSt + “Jackson, MS 39288-7328”

End Select

MyWord.Selection.TypeText(astr)

For i = 1 To 2

MyWord.Selection.TypeText(RetSt)

Next i

astr = frstTxtBox.Text + ” “ + lstTxtBox.Text + RetSt + currTxtBox.Text + RetSt

MyWord.Selection.TypeText(astr)

For i = 1 To 2 : MyWord.Selection.TypeText(RetSt) : Next i

currdate = Date.Now

astr = “Date: “ + currdate + RetSt

MyWord.Selection.TypeText(astr)

For i = 1 To 2 : MyWord.Selection.TypeText(RetSt) : Next i

astr = “To whom it may concern: “ + RetSt

MyWord.Selection.TypeText(astr)

For i = 1 To 2 : MyWord.Selection.TypeText(RetSt) : Next i

astr = “I request to have my name removed from your marketing lists. Here is the information you have asked me to include in my request:” + RetSt

MyWord.Selection.TypeText(astr)

For i = 1 To 2 : MyWord.Selection.TypeText(RetSt) : Next i

MyWord.Selection.Font.Size = 11

‘ Build a table

ro = 6 ‘Numbers of rows

co = 2 ‘Numbers of columns

MyTable = MyWord.Selection.Tables.Add(MyWord.Selection.Range, ro, co)

MyCols = MyTable.Columns

MyCols(1).Width = 250

MyCols(2).Width = 250

‘ Fill out the table

MyWord.Selection.Font.Bold = True

MyCell = MyTable.Cell(1, 1) : MyCell.Select() : MyCell.Split(2) : MyWord.Selection.TypeText(“FIRST, MIDDLE & LAST NAME”)

MyCell = MyTable.Cell(2, 1) : MyCell.Select() : MyWord.Selection.TypeText(“(List all name variations, including Jr., Sr., etc.)”)

MyCell = MyTable.Cell(1, 2) : MyCell.Select() : MyWord.Selection.TypeText(frstTxtBox.Text + ” “ + midTxtBox.Text + ” “ + lstTxtBox.Text)

MyWord.Selection.Font.Bold = True

MyCell = MyTable.Cell(3, 1) : MyCell.Select() : MyWord.Selection.TypeText(“CURRENT MAILING ADDRESS”)

MyCell = MyTable.Cell(3, 2) : MyCell.Select() : MyWord.Selection.TypeText(currTxtBox.Text)

MyCell = MyTable.Cell(4, 1) : MyCell.Select() : MyCell.Split(2) : MyWord.Selection.TypeText(“PREVIOUS MAILING ADDRESS”)

MyCell = MyTable.Cell(5, 1) : MyCell.Select() : MyWord.Selection.TypeText(“(Fill in your previous mailing address if you have moved in the last 6 months.)” + RetSt + “Note: not required by Equifax and Experian.”)

If flag = 3 Then

MyCell = MyTable.Cell(4, 2) : MyCell.Select() : MyWord.Selection.TypeText(prevTxtBox.Text)

Else

MyCell = MyTable.Cell(4, 2) : MyCell.Select() : MyWord.Selection.TypeText(“”)

End If

MyCell = MyTable.Cell(6, 1) : MyCell.Select() : MyCell.Split(2) : MyWord.Selection.TypeText(“SOCIAL SECURITY NUMBER”)

MyCell = MyTable.Cell(7, 1) : MyCell.Select() : MyWord.Selection.TypeText(“Note: not required by Experian.”)

If flag = 1 Or flag = 3 Then

MyCell = MyTable.Cell(6, 2) : MyCell.Select() : MyWord.Selection.TypeText(ssnTxtBox.Text)

Else

MyCell = MyTable.Cell(6, 2) : MyCell.Select() : MyWord.Selection.TypeText(“”)

End If

MyCell = MyTable.Cell(8, 1) : MyCell.Select() : MyCell.Split(2) : MyWord.Selection.TypeText(“DATE OF BIRTH”)

MyCell = MyTable.Cell(9, 1) : MyCell.Select() : MyWord.Selection.TypeText(“Note: not required by Equifax and Experian.”)

If flag = 3 Then

MyCell = MyTable.Cell(8, 2) : MyCell.Select() : MyWord.Selection.TypeText(DateTimePicker.Value.ToShortDateString)

Else

MyCell = MyTable.Cell(8, 2) : MyCell.Select() : MyWord.Selection.TypeText(“”)

End If

‘Exit from table

MyCell = MyTable.Cell(10, 2) : MyCell.Select()

MyCell = Nothing

MyWord.Selection.GoToNext(Word.WdGoToItem.wdGoToLine)

For i = 1 To 3 : MyWord.Selection.TypeText(RetSt) : Next i

MyWord.Selection.Font.Size = 12

MyWord.Selection.TypeText(“Thank you for your prompt handling of my request.”)

For i = 1 To 3 : MyWord.Selection.TypeText(RetSt) : Next i

MyWord.Selection.TypeText(“_______________________________”)

MyWord.Selection.TypeText(RetSt)

MyWord.Selection.Font.Bold = True

MyWord.Selection.Font.Size = 10

MyWord.Selection.TypeText(“SIGNATURE of “ + frstTxtBox.Text + ” “ + lstTxtBox.Text)

 

End Sub

Private Sub prevTxtBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles prevTxtBox.MouseClick

prevTxtBox.Text = “”

End Sub

End Class

Posted in VB.NET | 1 Comment »