?
Solved

Code as a DLL or Control?

Posted on 2009-05-03
3
Medium Priority
?
169 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 1500 total points
ID: 24300773
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

741 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