Jump to content
Xtreme .Net Talk

a_jam_sandwich

Avatar/Signature
  • Posts

    371
  • Joined

  • Last visited

Everything posted by a_jam_sandwich

  1. Right ive make an updater for my App. After updating using the updater, i try running the app from the shortcuts on the desktop created in an vs.net deploment project. Every time I run it the windows installer pops up try to install somthing from the (.msi) setup file. Anyone help as its really bugging me :( Cheers Andy
  2. No matter down to the sevice provier have a firewall and being a general pain in the arse
  3. Ive come to a BIG problem Downloading from the LAN connection works great Donwloading from a modem (Only One Though) come up with the error (403) access to this page is forbiddon Anyone Help
  4. for those of you looking to create Live updaters and were wondering how heres so code me and tHe_cLeanER have put together with progress bar support and saving to files. Function DownloadChunks(ByVal sURL As String, ByVal pProgress As ProgressBar, ByVal Filename As String) Dim wRemote As System.Net.WebRequest Dim URLReq As HttpWebRequest Dim URLRes As HttpWebResponse Dim FileStreamer As New FileStream(Filename, FileMode.Create) Dim bBuffer(999) As Byte Dim iBytesRead As Integer Try URLReq = WebRequest.Create(sURL) URLRes = URLReq.GetResponse Dim sChunks As Stream = URLReq.GetResponse.GetResponseStream pProgress.Maximum = URLRes.ContentLength Do iBytesRead = sChunks.Read(bBuffer, 0, 1000) FileStreamer.Write(bBuffer, 0, iBytesRead) If pProgress.Value + iBytesRead <= pProgress.Maximum Then pProgress.Value += iBytesRead Else pProgress.Value = pProgress.Maximum End If Loop Until iBytesRead = 0 pProgress.Value = pProgress.Maximum sChunks.Close() FileStreamer.Close() Return sResponseData Catch MsgBox(Err.Description) End Try End Function Should be fairly easy to understand, Ill have a program soon as a Live Updater in test at the mo. It will support versioning from a standard HTTP server :) sURL is where your requesting your download from e.g. 'www.mysite.com/files/' filename is the file your downloading 'myprogram.exe' incase you were wondering
  5. Im trying to create a support system program. When using the system you can run it in the Systray, and when a request come in a POPUP form will display indicating the request. The problem is I dont want to lose focus from the program that the users in as it just a notiforcation (VISUAL ONLY). I know the API method in VB6 with ShowWindow using SW_SHOWNOACTIVE but have no idea what to do in VB.NET Can anyone help Cheers Andy
  6. Tried your suggestion worked. Thx a lot Andy
  7. I've not been on for a while (Off work) so happy new year to you all. I've started looking at ADO.NET and trying inserting a record into a ACCESS2000 database. The problems.... I what to use datasets as In the software i'm creating Relationship Links are a nice idea. The following CODE doesn't work with the error; Syntax error in INSERT INTO statement. Anyone know what im doing wrong???? Also when looking at the SQL in the OleDbCommandBuilder all there is, is ?????????? where the values should be :( Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\support.mdb" Dim SelectString As String = "SELECT * FROM SUPPORT" Dim MyConn As New OleDbConnection(ConnectionString) Dim MyAdapter As New OleDbDataAdapter() MyAdapter.SelectCommand = New OleDbCommand(SelectString, MyConn) Dim CommandBuilder As OleDbCommandBuilder = New OleDbCommandBuilder(MyAdapter) Dim MyDataset As New DataSet() Dim MyTable As New DataTable() Try MyConn.Open() MyAdapter.FillSchema(MyDataset, SchemaType.Source, "Support") MyAdapter.Fill(MyDataset, "Support") MyTable = MyDataset.Tables("Support") Dim MyRow As DataRow = MyTable.NewRow MyRow(2) = "Mr D" MyTable.Rows.Add(MyRow) MsgBox(CommandBuilder.GetInsertCommand.CommandText.ToString) MyAdapter.Update(MyDataset, "Support") Catch ex As OleDbException Console.WriteLine(ex.Message) End Try Cheers Andy.
  8. Ive come up with this so far pretty unstructured as yet but works slow. Private Sub pdoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pdoc.PrintPage Dim iMargin As Integer = 15 Dim margin As Integer = 10 Dim i As Integer = 0 Dim theWord As String = "" Dim iPos As Integer Dim TextLine As String Dim bLine As Boolean = False Dim fmt As New StringFormat() fmt.FormatFlags = StringFormatFlags.LineLimit Printer.PrinterSettings.DefaultPageSettings.Margins.Left = 75 Printer.PrinterSettings.DefaultPageSettings.Margins.Right = 75 Printer.PrinterSettings.DefaultPageSettings.Margins.Top = 40 Printer.PrinterSettings.DefaultPageSettings.Margins.Bottom = 40 Dim rectPrintingArea As New RectangleF(Printer.PrinterSettings.DefaultPageSettings.Margins.Left, _ Printer.PrinterSettings.DefaultPageSettings.Margins.Top, _ Printer.PrinterSettings.DefaultPageSettings.Margins.Right - Printer.PrinterSettings.DefaultPageSettings.Margins.Left, _ Printer.PrinterSettings.DefaultPageSettings.Margins.Bottom - Printer.PrinterSettings.DefaultPageSettings.Margins.Top) Dim xPos As Integer = Printer.PrinterSettings.DefaultPageSettings.Margins.Left Dim yPos As Integer = Printer.PrinterSettings.DefaultPageSettings.Margins.Top For i = 0 To RTB.Text.Length RTB.Select(i, 1) Dim sChar As Char = RTB.SelectedText Dim cColor As Color = RTB.SelectionColor Dim fFont As Font = RTB.SelectionFont Dim iHeight As Integer = fFont.Height Dim theSize As New SizeF(e.Graphics.MeasureString(theWord, fFont)) If Asc(sChar) = 10 Then e.Graphics.DrawString(theWord, fFont, New SolidBrush(cColor), xPos, yPos) xPos += Int(theSize.Width) theWord = "" xPos = Printer.PrinterSettings.DefaultPageSettings.Margins.Left yPos += iHeight + 3 ElseIf Not Asc(sChar) = 32 Or Asc(sChar) = 10 Or Asc(sChar) = 8 Then theWord = theWord & sChar Else If (xPos + theSize.Width > (Printer.PrinterSettings.DefaultPageSettings.PaperSize.Width - 75)) Then xPos = Printer.PrinterSettings.DefaultPageSettings.Margins.Left yPos += iHeight + 3 End If e.Graphics.DrawString(theWord, fFont, New SolidBrush(cColor), xPos, yPos) xPos += Int(theSize.Width) theWord = "" End If Next End Sub :) Needs support for multipage
  9. Where as the main run icon or in the top left when running?
  10. How the hec do you print a rich text box formatted Andy :confused:
  11. Thax for the information as regards not to using COM object iv'e only start VB.NET 3 days ago still learing the fundimentals :)
  12. Using ADO the connection is the major bit about the type of database your connecting to the Record Set is the same for both You create a Record Set by ... ' Create your connection Dim MyConn as ADODB.Connection ' Create your Recordset Dim MyRs as ADODB.Recordset MyConn = New ADODB.Connection MyRs = New ADODB.recordset ' Open the Connection MyConn.Open(Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\" & DatabaseName & ";Persist Security Info=False) ' Open The Recordset based on the SELECT Query MyRs.Open("SELECT * FROM MyTABLE", MyConn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic) While Not MyRs.EOF ' Code to look at the returned recordset ' e.g. console.writeline(MyRs.Fields("LASTNAME").Value) Wend ' Close all MyRs.Close MyConn.Close Hope this helps
  13. Imports System.Data.SqlClient Module Module9 public Function CheckPassword(ByRef UID As String, ByRef Password As String) As Boolean Dim myConnection As New SqlConnection() Dim myRs As ADODB.Recordset myConnection.ConnectionString = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=DATABASENAME" myConnection.Open() myRs = New ADODB.Recordset() myRs.Open("SELECT UserID,PASSWORD FROM MyTABLE WHERE UserID='" & UID & "' AND PASSWORD='" & Password & "'", myConnection, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic) If myRs.RecordCount > 0 Then CheckPassword = True Else CheckPassword = False End If myRs.Close() myConnection.Close() End Function End Module Try somthing like this
  14. Thanks for your help
  15. Do you no any tutorials or samples for doing what you suggest? Cheers
  16. I require to download a set of files i.e this is a updater for changes withing the database to be downloaded from the internet. I need to add a progress meter into program I've tried looking for the right event but with no joy. The code below works as it was taken from 101 samples of VB.NET anyway Dim fs As FileStream Dim req As WebRequest Try req = WebRequest.Create("http://www.website.com/filename.pdf") req.Method = "GET" Dim rsp As WebResponse = req.GetResponse() Try fs = New FileStream("ReceivedXMLFile.pdf", FileMode.Create) CopyData(rsp.GetResponseStream(), fs) Msgbox (CStr(rsp.ContentLength / 1024) & " KB's Downloaded") Catch exp As Exception MessageBox.Show(exp.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop) Finally If Not rsp Is Nothing Then rsp.GetResponseStream.Close() If Not fs Is Nothing Then fs.Close() Please help Cheers :(
×
×
  • Create New...