Solved

Code as a DLL or Control?

Posted on 2009-05-03
3
168 Views
Last Modified: 2013-12-26
Hi Experts,

Now I'm not sure if this is possible, but I'd like to convert the following code into either a control, or a DLL. The code below currently sits in a menuitem procedure which when clicked, takes data stored in a text file and sends it to a pre-defined web page.

What I need is to have the text elements of the code i.e msgbox text, configurble as part of a control with properties to set or as a configurable DLL if there is such a thing? The most important part though is the web request create, Ideally I want it so that I can enter a number in a control poroperty and the code creates the temp variables?

ProgressBar1.Visible = True
        ProgressBar1.Value = 10
        Try
            If File.Exists(strAppDir & "\import.txt") = True Then
 
                Dim fsa As New FileStream(strAppDir & "\import.txt", FileMode.Open, FileAccess.Read)
                'declaring a FileStream to open the file named import.txt with access mode of reading
                Dim da As New StreamReader(fsa)
                da.BaseStream.Seek(0, SeekOrigin.Begin)
 
                Dim tempa As String
 
                'Send the data to the script
                Do While da.Peek() > -1
                    Dim temp As String()
                    tempa = da.ReadLine
 
                    Dim fl As Int16 = 0
                    Dim i2 As Int16 = 0
 
                    temp = tempa.Split(" ")
 
                    Dim req As WebRequest = WebRequest.Create(script & "?1=" & temp(0) & "&2=" & temp(1) & "&3=" & temp(2) & "&4=" & temp(3) & "&5=" & temp(4) & "&6=" & temp(5) & "&7=" & temp(6) & "&8=" & temp(7) & "&9=" & temp(8) & "&10=" & temp(9) & "&11=" & temp(10) & "&12=" & temp(11) & "&13=" & temp(12) & "&14=" & temp(13) & "&15=" & temp(14) & "&16=" & temp(15) & "&17=" & temp(16) & "&18=" & temp(17) & "&19=" & temp(18) & "&20=" & temp(19) & "&21=" & temp(20) & "&22=" & temp(21) & "&23=" & temp(22) & "&24=" & temp(23) & "&25=" & temp(24) & "&26=" & temp(25) & "&27=" & temp(26) & "&28=" & temp(27) & "&29=" & temp(28) & "&30=" & temp(29) & "&31=" & temp(30) & "&32=" & temp(31) & "&33=" & temp(32) & "&34=" & temp(33) & "&35=" & temp(34) & "&36=" & temp(35) & "&37=" & temp(36) & "&38=" & temp(37) & "&39=" & temp(38) & "&40=" & temp(39) & "&41=" & temp(40) & "&42=" & temp(41) & "&43=" & temp(42) & "&44=" & temp(43) & "&45=" & temp(44) & "&46=" & temp(45) & "&47=" & temp(46) & "&48=" & temp(47) & "&49=" & temp(48) & "&50=" & temp(49) & "&51=" & temp(50) & "&52=" & temp(51) & "&53=" & temp(52) & "&54=" & temp(53) & "&55=" & temp(54) & "&56=" & temp(55) & "&57=" & temp(56) & "&58=" & temp(57) & "&59=" & temp(58) & "&60=" & temp(59) & "&61=" & temp(60) & "&62=" & temp(61) & "&63=" & temp(62) & "&64=" & temp(63) & "&65=" & temp(64) & "&66=" & temp(65) & "&67=" & temp(66))
                    Dim resp As WebResponse = req.GetResponse()
                    resp.Close()
 
                Loop
                ProgressBar1.Value = 100
                da.Close()
                File.Delete(strAppDir & "\import.txt")
                ProgressBar1.Value = 0
                ProgressBar1.Visible = False
                MsgBox("Data transmission successful.", MsgBoxStyle.OkOnly, "Project MFD")
            End If
 
        Catch ex As IndexOutOfRangeException
            MsgBox("An unauthorised manual modification of the transmission data has occurred, please contact support for assistance.", MsgBoxStyle.OkOnly, "Project MFD Error")
 
        Catch ex As Exception
            MsgBox("One of the following errors has occurred:" & (Chr(13)) & (Chr(13)) & "1. MDA signal is weak. (Perform soft reset with the stylus, move to a better area, try again)" & (Chr(13)) & (Chr(13)) & "2. MDA transmitter is switched off. (Call support)", MsgBoxStyle.OkOnly, "Project MFD Transmission Error")
            ProgressBar1.Value = 0
            ProgressBar1.Visible = False
 
        End Try

Open in new window

0
Comment
Question by:Zoooink
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Expert Comment

by:JackOfPH
ID: 24292473
If you want GUI then control if not DLL
0
 
LVL 3

Author Comment

by:Zoooink
ID: 24295570
No GUI is required, but I need to be able to set properties, is it just a case of copying this code and creating a DLL? I have never done one...
0
 
LVL 15

Accepted Solution

by:
JackOfPH earned 500 total points
ID: 24300773
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question