Jump to content
Xtreme .Net Talk

Shims

Avatar/Signature
  • Posts

    39
  • Joined

  • Last visited

About Shims

  • Birthday 02/07/1984

Personal Information

  • Visual Studio .NET Version
    Enterprise Archetect 2002
  • .NET Preferred Language
    VB.Net

Shims's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Shims

    Sorting...

    true, however, i need to sort a whole line of data based on the phone number, not the first character on the line. And this isnt bubble sort, it is a quicksort.
  2. Shims

    Sorting...

    yes, but i need to other full array to be sorted as well... this is my code... but it shuts off the program w/o error if i have over 55,000 lines. Imports System.IO Public Class Form1 Inherits System.Windows.Forms.Form Dim blah As New System.Text.RegularExpressions.Regex("\d\d\d-\d\d\d-\d\d\d\d") Dim blah2 As New System.Text.RegularExpressions.Regex("\d\d\d-\d\d\d") #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog() Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog() Me.Button1 = New System.Windows.Forms.Button() Me.Button2 = New System.Windows.Forms.Button() Me.Button3 = New System.Windows.Forms.Button() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.TextBox2 = New System.Windows.Forms.TextBox() Me.SuspendLayout() ' 'SaveFileDialog1 ' Me.SaveFileDialog1.FileName = "doc1" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(400, 56) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(75, 20) Me.Button1.TabIndex = 0 Me.Button1.Text = "Open" ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(400, 104) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(75, 20) Me.Button2.TabIndex = 1 Me.Button2.Text = "Save As" ' 'Button3 ' Me.Button3.Location = New System.Drawing.Point(400, 184) Me.Button3.Name = "Button3" Me.Button3.Size = New System.Drawing.Size(75, 20) Me.Button3.TabIndex = 2 Me.Button3.Text = "Filter" ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(160, 56) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(216, 20) Me.TextBox1.TabIndex = 3 Me.TextBox1.Text = "" ' 'TextBox2 ' Me.TextBox2.Location = New System.Drawing.Point(160, 104) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(216, 20) Me.TextBox2.TabIndex = 4 Me.TextBox2.Text = "" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(624, 273) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox2, Me.TextBox1, Me.Button3, Me.Button2, Me.Button1}) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) End Sub #End Region Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Public Sub Quicksort(ByVal list() As Long, ByVal str() As String, ByVal min As Long, ByVal max As Long) Dim med_value As Long Dim med_value2 As String Dim hi As Long Dim lo As Long Dim i As Long ' If min >= max, the list contains 0 or 1 items so it ' is sorted. If min >= max Then Exit Sub ' Pick the dividing value. i = Int((max - min + 1) * Rnd() + min) med_value = list(i) med_value2 = str(i) ' Swap it to the front. list(i) = list(min) str(i) = str(min) lo = min hi = max Do ' Look down from hi for a value < med_value. Do While list(hi) >= med_value hi = hi - 1 If hi <= lo Then Exit Do Loop If hi <= lo Then list(lo) = med_value str(lo) = med_value2 Exit Do End If ' Swap the lo and hi values. list(lo) = list(hi) str(lo) = str(hi) ' Look up from lo for a value >= med_value. lo = lo + 1 Do While list(lo) < med_value lo = lo + 1 If lo >= hi Then Exit Do Loop If lo >= hi Then lo = hi list(hi) = med_value str(hi) = med_value2 Exit Do End If ' Swap the lo and hi values. list(hi) = list(lo) str(hi) = str(lo) Loop ' Sort the two sublists. Quicksort(list, str, min, lo - 1) Quicksort(list, str, lo + 1, max) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim i As Integer = -1 Dim b As Integer Dim strReader As StreamReader = New StreamReader(New FileStream(TextBox1.Text, FileMode.Open)) Do Until strReader.Peek < 0 i += 1 strReader.ReadLine() Loop strReader.Close() Dim al(i) As Long Dim str(i) As String b = i strReader = New StreamReader(New FileStream(TextBox1.Text, FileMode.Open)) i = -1 Do Until strReader.Peek < 0 i += 1 str(i) = strReader.ReadLine() Loop strReader.Close() Dim tempstr As String For i = 0 To str.Length - 1 Try tempstr = blah.Match(str(i)).Value tempstr = blah2.Match(tempstr).Value al(i) = tempstr.Replace("-", "") Catch End Try Next Quicksort(al, str, 0, b) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click OpenFileDialog1.Filter = "Text Files (*.txt)|*.txt" OpenFileDialog1.ShowDialog() TextBox1.Text = OpenFileDialog1.FileName.ToString End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click SaveFileDialog1.Filter = "Text Files (*.txt)|*.txt" SaveFileDialog1.ShowDialog() TextBox2.Text = SaveFileDialog1.FileName.ToString End Sub Private Sub Write(ByVal str() As String) Dim strWriter As StreamWriter = New StreamWriter(New FileStream(TextBox2.Text, FileMode.CreateNew)) Dim i As Integer For i = 0 To str.Length - 1 strWriter.WriteLine(str(i)) Next strWriter.Close() End Sub End Class
  3. Shims

    Sorting...

    Ok, i made used a quicksort to sort the information. I made an array that holds just the telephone numbers and a seperate one that holds all the other info including the phone number. Anyhow, during the process, if there is over 55,000 lines that i am sorting, the program shuts itself off without any errors... wierd. Ill try the 2 dimensional array idea though. Thanks
  4. Shims

    Sorting...

    i mean in one text line
  5. Shims

    Sorting...

    yea, its all in one string in a text file.
  6. Shims

    Sorting...

    the data i sorted like this: 123 ab street 555-555-5555 i just want to sort it based on the first 6 of the phone number
  7. Shims

    Sorting...

    Ok, so i want to sort a whole line of information very efficiently. I am not too sure how sorting subroutines work...but i want to sort just based on the area code of a phone number which is contained in a line that has a lot more information on it....can someone point me in the right direction?
  8. Dim brush1 As System.Drawing.Brush brush1 = System.Drawing.Brushes.Black Dim image1 As System.Drawing.Image = System.Drawing.Image.FromFile("c:/Inetpub/wwwroot/Webapplication1/Default_Layout/select_card.jpg") Try Dim GR As Graphics = Graphics.FromImage(image1) GR.SmoothingMode = SmoothingMode.HighQuality GR.CompositingQuality = CompositingQuality.HighQuality GR.CompositingMode = CompositingMode.SourceOver GR = Graphics.FromImage(image1) GR.DrawString(strCo_Name, New Font("Arial", 16, FontStyle.Bold), brush1, 10, 15) GR.DrawString(strName, New Font("Arial", 13, FontStyle.Bold), brush1, 11.5, 45) GR.DrawString(strTitle, New Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Pixel), brush1, 13, 61) GR.DrawString(strAddress, New Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Pixel), brush1, 12, 91) GR.DrawString(strAddress2, New Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Pixel), brush1, 12, 107) GR.DrawString(strAddress3, New Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Pixel), brush1, 12, 123) GR.DrawString(strAddress4, New Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Pixel), brush1, 12, 139) GR.DrawString(strEmail, New Font("Arial", 11, FontStyle.Regular), brush1, New System.Drawing.RectangleF(50, 19, 245, 20), New System.Drawing.StringFormat(StringFormatFlags.DirectionRightToLeft)) GR.DrawString(strWebsite, New Font("Arial", 11, FontStyle.Regular), brush1, New System.Drawing.RectangleF(50, 30, 245, 20), New System.Drawing.StringFormat(StringFormatFlags.DirectionRightToLeft)) GR.DrawString(strPhone, New Font("Arial", 12, FontStyle.Regular), brush1, New System.Drawing.RectangleF(51, 122, 245, 20), New System.Drawing.StringFormat(StringFormatFlags.DirectionRightToLeft)) GR.DrawString(strPhone2, New Font("Arial", 12, FontStyle.Regular), brush1, New System.Drawing.RectangleF(51, 137, 245, 20), New System.Drawing.StringFormat(StringFormatFlags.DirectionRightToLeft)) image1.Save("C:\Inetpub\wwwroot\WriteMe\blah.jpg") image1.Save("C:\Inetpub\wwwroot\WriteMe\blah2.jpg") Catch err As System.Runtime.InteropServices.ExternalException Return err.Message End Try So the image itself is changing, but the url isnt... to display the current image the page must be refreshed
  9. didnt work :(
  10. Is it possible to run certain functions of adobe photoshop to edit images on a windows form? because when i use graphics to draw text onto an image, the quality is very poor
  11. I am filling an asp.net image control from a picture that is constantly changing. However if the picture changes and the page gets posted back, the new image doesnt appear. It will only appear if i hit the refresh button, got any ideas?
  12. by the way, do you just know all this stuff off hand or what kind of resource do you use?
  13. you are the f-ing MAN!!!
  14. Is there anyway to lay text on top of an image in a windows app and save it all as an image?
  15. Shims

    Controls

    does anybody know? is this possible?
×
×
  • Create New...