
russgreen
Avatar/Signature-
Posts
29 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by russgreen
-
Populating a combobox via a StreamReader and an Array
russgreen replied to trippbrown's topic in Windows Forms
Was yours anything like this? Public Function PopulateComboFromFile(ByVal ListControl As ComboBox, ByVal FullPath As String, _ ByVal Blank As Boolean, Optional ByVal Delimiter As String = vbCrLf) As Boolean Dim objFso As New Scripting.FileSystemObject() Dim objTextStream As Scripting.TextStream Dim strContents As String Dim arrContents() As String Dim lCtr As Long, lCount As Long Try 'Ensure file exists If Dir(FullPath) = "" Then MsgBox("The file " & FullPath & " does not exist", MsgBoxStyle.OKOnly, "Load contract lists") Exit Function End If 'Get file contents objTextStream = objFso.OpenTextFile(FullPath, Scripting.IOMode.ForReading) strContents = objTextStream.ReadAll objTextStream.Close() 'Split file contents based on delimiter arrContents = Split(strContents, Delimiter) lCount = UBound(arrContents) ListControl.Items.Clear() 'Clear List Control. ListControl.Items.AddRange(arrContents) 'Populate list control If Blank = True Then ListControl.Items.AddRange(New Object() {" "}) 'add blank rows to each combo End If PopulateComboFromFile = True Catch ex As Exception objTextStream = Nothing objFso = Nothing MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Load contract lists") End Try End Function -
I'm using a Setup Project in VB.NET 2003 Standard to install a windows service application. I would like this installer to start the service after install. How do I do that? Thanks, Russ
-
how would you get a service to restart itelf?
-
Ok, sort of worked it out with this <asp:HyperLink id="HyperLink1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CompanyName") %>' NavigateUrl='<%# "db_project_bus-card.aspx?tbl=ClientCorp&ID=" & Databinder.Eval (Container, "DataItem.ClientCorpID") %>' Font-Size="Small" Font-Names="Arial" Font-Bold="True" ForeColor="Blue"></asp:HyperLink> but cannot get by javascript to work. Quotes get closed early...
-
I'm trying to pass multiple arguements from one page to another in the URL. I'm using a hyperlink control inside a datalist and I'm trying to add the value that this HTML string would normally be able to get '<%# DataBinder.Eval(Container, "DataItem.ClientCorpID") %>' into the URL here:- db_project_bus-card.aspx?tbl=ClientCorp&ID= " some value to go here " How can I do this? My HTML currently looks like this:- <asp:HyperLink id="HyperLink1" runat="server" ForeColor="Blue" Font-Bold="True" Font-Names="Arial" Font-Size="Small" NavigateUrl="JAVASCRIPT:openPopWin('db_project_bus-card.aspx?tbl=ClientCorp&ID= " some value to go here " ', 400, 400)" Text='<%# DataBinder.Eval(Container, "DataItem.CompanyName") %>' ></asp:HyperLink> I also have another similar problem. I have a hyperlink control that gets its link value (an email address) from a dataset in a similar way but I want to add "mailto:" to the URL. I guessed it would be as below but it obviously doesn't work. Is this possible? <asp:HyperLink id="hplEml" runat="server" text='<%# DataBinder.Eval(Container, "DataItem.Email") %>' Font-Size="X-Small" Target="_blank" navigateURL="mailto:" + '<%# DataBinder.Eval(Container, "DataItem.Email") %>' BackColor="White" ></asp:HyperLink> Thanks in advance. Russ db_list_client-corp.zip
-
same as davemcminoway I am in axactly the same position as davemcminoway. Using a datagrid and I want to trap the Broswer refresh to reload my data but not actually refresh the browser. You end up with the update command going off when it shouldn't.
-
I need the refrence to Windows.Forms to interact with the desktop in order to write to the log files. I just had a go with System.Reflection.Assembly.GetExecutingAssembly.Location but it didn't work. How does UDP perform?
-
I have narrowed down the problem. :D I get my service working fine now with the on start Dim watcherThread As Thread = New Thread(AddressOf listener) Protected Overrides Sub OnStart(ByVal args() As String) WriteToLog("logs\webproxy.log", "Service started") watcherThread.Start() End Sub the listener code is this Private Sub listener() Dim tcplistener As New TcpListener(port) tcplistener.Start() WriteToLog("logs\webproxy.log", "Listening on port " & port.ToString) 'While True ' Dim socket As Socket = tcplistener.AcceptSocket() ' Dim webproxy As New WebProxy(socket) ' Dim thread As New Thread(New ThreadStart(AddressOf webproxy.runproxy)) ' thread.Start() 'End While End Sub :confused: The problem code has been commented out. How else can I continuously monitor the tcp port for sockets? :mad: My WriteToLog isn't working in a service either. Any ideas? It works in all my winforms and console apps. :confused: Is there a service equivalent of Application.Startuppath? Public Sub WriteToLog(ByVal Filename As String, ByVal Comment As String) Dim sw As System.IO.StreamWriter Try sw = New System.IO.StreamWriter(Filename, True) sw.WriteLine(Date.Now & " " & Comment) sw.Flush() Catch e As Exception Finally If Not sw Is Nothing Then sw.Close() End Try End Sub Russ
-
It seems to work OK but as you probably noticed there are some lines of code commented out that should write to a log file. When I uncomment this code it fails to write to the log so I'm not really sure if its doing its job. I made a console version which works well so I know the main bulk of the code is OK but this is my first go at programming a service. Russ
-
So you think my code looks OK?
-
I've posted the project in its current state here. WebProxy Russ
-
Great thanks, I've just done that, created a service and installer and installed my service. It show up in the list of services now but when trying to start it it takes too long and the status is stuck on starting. Any ideas? Russ
-
Does anyone know of a macro or way of enabling Windows service projects to be created in VB.NET standard? Thomas Erdösi has written a fantastic macro to enable new projects to be compiled to dll's. If not the would someone be kind enough to create a new blank windows service project for me? Russ
-
Info on Creating a Live Updater - Download code
russgreen replied to a_jam_sandwich's topic in Network
I figured that one out as well. It did work when the folder existed. I'm going to try to extend your code if you don't mind. I want to be able to create folders, delete files and possible executre ReadMe files when a user updates the app. It should only be a small extension to make all that possible though. Russ -
Info on Creating a Live Updater - Download code
russgreen replied to a_jam_sandwich's topic in Network
OK I miss understood the files. Wow. This really is good code.. I am getting errors though when trying to use subfolders. Can someone just clarify how its supposed to work if I need to put a file in a subdirectory on the local machine ? I have this as my update.dat file but it genrates errors. [VERSIONLIST] VERSION=1.2.2 updateinformation=Welcome to the updater for Project Database Suite [uPDATELIST] # If the version is > 1 e.g. 1.0.1 - 1.0.0 = 1 where 1.0.1 is download version then download # all files marked FILE# *numbers must be in sequence* # you can include subfolders e.g. myfolder/myfile the subfolder is the folder located on the # computer being downloaded to NOT the HTTP server #FILE1=<FILENAME> #FILE2=<FILENAME> #FILE3=<FILENAME> #FILE4=<FILENAME> FILE1=lists/folders.lst # If the version is > 1 e.g. 1.0.2 - 1.0.0 = 2 where 1.0.1 is download version then download # all files marked FILE-UPDATE# *numbers must be in sequence* #FILE-UPDATE1=<FILENAME> #FILE-UPDATE2=<FILENAME> #FILE-UPDATE3=<FILENAME> #FILE-UPDATE4=<FILENAME> FILE-UPDATE1=folders.lst # Created by Andrew Duff, (C) 2003 This is the line in the log file... 05/04/2003 15:46:54 ERRROR Could not find a part of the path "D:\Development Resources\Downloads\Updater.Net\bin\TEST\Downloading_lists\folders.lst"., 76 Russ -
Info on Creating a Live Updater - Download code
russgreen replied to a_jam_sandwich's topic in Network
This is a great bit of code.... I want to implement it into my app but I'll have multiple files to update and not always the same files. Can this work on whole folders? ie look at a folder on my website and download the entire contents of that folder. If not do you know how hard it would be to unzip and zip file automatically when it has finished downloading? Russ -
so are the rtf controls in v.2003 any better?
-
This is really odd. It seems I need to do a SelectionColor = Color.Black on every other line
-
Including the SelectionColor = Color.Black everytime and it works but I'm sure I shouldn't have to .SelectionFont = hdg1Font .AppendText(strJobType & " Project Details" & vbCrLf) .SelectionFont = smlFont .AppendText("report generated on : " & Common.MonthShort & vbCrLf) .SelectionFont = smlFont .SelectionColor = Color.Black .AppendText("report generated by : " & strUser & vbCrLf) .AppendText("" & vbCrLf)
-
Well interstingly I just opened the saved rtf file in notepad and this {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil Arial;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}} {\colortbl ;\red255\green0\blue0;} \viewkind4\uc1\pard\b\f0\fs28 Residential Project Details\par \b0\fs16 report generated on : 29MAR03\par report generated by : Russ Green\par \f1\fs17\par \b\f0\fs24 2103_TEST PROJECT\par \b0\fs20 This job is currently active : True\par \f1\fs17\par \b\f0\fs20 Project Status:\par \b0 NEW PROJECT\par \cf1 rrrrrrrrrrrrrrrrrrrrrrrr\par \cf0 Action to be taken by rg\par \f1\fs17\par \b\f0\fs20 Description:\par \b0 bcvbcvbcvfvbfbbgsb\par \f1\fs17\par \b\f0\fs20 Contracts:\par \b0 Form of contract\tab\tab : \par Form of engagement\tab : \par \f1\fs17\par \b\f0\fs20 Location:\par \b0 12B MORPETH ST\par \par \par HU3 1RF\par \f1\fs17\par \par }
-
Well I just tried this based on what you said then and the same result .SelectionFont = hdg1Font .AppendText(strJobType & " Project Details" & vbCrLf) .SelectionFont = smlFont .AppendText("report generated on : " & Common.MonthShort & vbCrLf & "report generated by : " & strUser & vbCrLf)
-
I have a save as on the rif control and I can save the contents of the richtextcontrol and open it in wordpad no problems Russ
-
The formatting in my programs rich text control is like this... With rtbReport .SelectionFont = hdg1Font .AppendText(strJobType & " Project Details" & vbCrLf) .SelectionFont = smlFont .AppendText("report generated on : " & Common.MonthShort & vbCrLf) .SelectionFont = smlFont .AppendText("report generated by : " & strUser & vbCrLf) .AppendText("" & vbCrLf) .SelectionFont = hdg2Font .AppendText(strJobNo & "_" & strJobName & vbCrLf) .SelectionFont = regFont .AppendText("This job is currently active : " & strJobState & vbCrLf) .AppendText("" & vbCrLf) '// etc etc End With Russ
-
I'm not clear about what you mean... Russ
-
Is there a difference in the rtf file format used by the richtextbox control and the rtf format used in ms outlook? I'm using this routing to send an email based on the formatted content of a rich text box but I am getting strange differences shown in the attached screenshot (follow link below). Does anyone have any ideas why this might be happening. Russ Private Sub Mailreport() Dim SendMail As System.Diagnostics.Process _ = System.Diagnostics.Process.Start("mailto:? Subject=Database Report - " & strTitle & " &body=" & Me.rtbReport.Rtf & "") End Sub http://www.russgreen.net/software/images/rtf-formatting.gif