|
kimbowa sande wrote: visual basic 6.0
STOP You are absolutely WASTING your time, download a copy of VB.Net express off the internet - it is FREE, no cost, no licence issue, nothing. Microsoft WANT you to have a copy
here is a link [^]
Now go out and buy, yes spend a little money, a book on VB.net. Spend some time getting to know VB.Net and then come back when you have a little knowledge and we'll help where we can.
I suggest you also get a book on database design as well, you will need it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
kimbowa sande wrote: visual basic 6.0
Don't.
vb6 is ancient, it's no good and never was, it's no longer supported.
Like Mycroft Holmes said use .NET
kimbowa sande wrote: Am a student studying information technology
I find it very hard to believe that vb6 is still being given at schools.
If so please tell me what school so I can personally go set them right.
kimbowa sande wrote: try to develop an online hotel reservation system
Online indicates this is a web application. So better forum might have been the ASP.NET forum.
|
|
|
|
|
Tom Deketelaere wrote: I find it very hard to believe that vb6 is still being given at schools.
I've been interviewing graduates this week. Quite a few have VB6 classes on their CV - it is quite disheartening.
|
|
|
|
|
Tom Deketelaere wrote: it's no good and never was
Despite that fact, it sold well. Lots of small "software" shops that sold VB6-based applications, lots of brownfields left
Tom Deketelaere wrote: I find it very hard to believe that vb6 is still being given at schools.
It is in the countries where the hardware is somewhat older - one has to use legacy-software. I can't imagine Vista on a 486.
I are troll
|
|
|
|
|
kimbowa sande wrote: I tried to code part of the customer data page
What is a "customer data page"?
May I suggest that you start by writing out use cases (short stories of how various users will interact with the system. A customer wants to do X, the hotel receptionist needs to check in a customer, the hotel receptionist needs to check out a customer, the customer wants a room for 4 people, etc.)
|
|
|
|
|
Hi SIR
Iam sorry for delaying. Here is the way i would like it to operate.
A client being able to place an order both locally and online,order and payment details stored and room number allocated.on arrival,the clients finger prints,image(biometrics)entered.the system able to remaind the user about new and old orders still standing and when an order is ending.the user having limited writes and the administrater having all the writes to view new and old orders.system able to sent e-mails to prominent clients usually about new services and greetings.
New and interested in learning visual basic
THANKS IN ADVANCE
|
|
|
|
|
Okay - Now break that down in to smaller pieces. To help you get started here are some questions you need to ask yourself
kimbowa sande wrote: A client being able to place an order both locally and online
How will a client be able to place an order online? What is the process? What information does the system need? What information does the client have?
What does "place an order locally" mean?
kimbowa sande wrote: order and payment details stored
How do you want to store this information? Do you have any constraints? For example, if you are storing payment details then you will have to be PCI (Payment Card Industry) Compliant - Which is very time consuming and expensive. Many companies use a third party payment processor so they don't have to worry so much. They only have to worry about the transmission of payment details and never the storage.
kimbowa sande wrote: the clients finger prints,image(biometrics)entered
Why do you need this? Do you think some customers may react negatively to it?
kimbowa sande wrote: system able to sent e-mails to prominent clients usually about new services and greetings.
Do you really need the system to do this? Normally, you would extract the email addresses needed and use a third party system to send out marketing mails.
|
|
|
|
|
hi guys..can u tell me how to add sql statement in my code
here's my code for the form load..
Private Sub frmManager_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'UserDataSet2.Staffapplication' table. You can move, or remove it, as needed.
Me.StaffapplicationTableAdapter.Fill(Me.UserDataSet2.Staffapplication)
txtRecordno.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Srecordno")
txtUsername.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Sname")
txtPassword.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Spassword")
txtHobby.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Shobby")
End Sub
i want those textboxes to displayed only data for a particular person
something like
"Select * from Staffapplication where MID ='" & frmLeave.txtUser.Text & "'"
how to add the sql statement in my code??
|
|
|
|
|
hi guys..im having a problem with my delete button
(let's say my database has 3 records)
and while my form is showing record no.3, and i clicked on the delete button, it will delete record no.1..(it supposed to be deleting record no.3)....how to correct my code and make it delete the record shown on the form????
here's my code..
Private Sub frmManager_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'UserDataSet2.Staffapplication' table. You can move, or remove it, as needed.
Me.StaffapplicationTableAdapter.Fill(Me.UserDataSet2.Staffapplication)
txtRecordno.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Srecordno")
txtUsername.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Sname")
txtPassword.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Spassword")
txtHobby.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Shobby")
End Sub
______________________________________________________________
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Dim intresult As Integer
Try
intresult = MessageBox.Show("Confirm Delete?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If intresult = Windows.Forms.DialogResult.Yes Then
Me.StaffapplicationBindingSource.RemoveCurrent()
Me.StaffapplicationTableAdapter.Update(Me.UserDataSet2.Staffapplication)
End If
Catch ex As Exception
End Try
(note: im using bindingSource for my textboxes anyway)
|
|
|
|
|
hi,
i have created simple billing software in vb.net with ms access.
Now i want to print all purchase, sales details or something..
but when we are going to print before see the print preview.
its all showing whatever in Query.
When i took print,nothing printing from db. but print other than DB.
i have attached sample code for mine.Plz Help me Urgent.
Private Sub Print_JOB_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
TOT = 0
INCR = 0
Sno = 1
PAGE_LIMIT = PER_PAGE
myConnection = New OleDbConnection(constr)
MyCommand.Connection = myConnection
'MyCommand.CommandText = "SELECT JOB_NAME,JOB_AMT FROM JOBCARD WHERE JOBNO=" + G_JOBNO + ""
MyCommand.CommandText = "SELECT JOB_NAME,JOB_AMT FROM JOBCARD WHERE JOBNO=128"
MyCommand.CommandType = CommandType.Text
ada.SelectCommand = MyCommand
ada.Fill(ds, "SALES_JOBMASTER")
dt = ds.Tables(2)
Data_Adapter()
' ROW_COUNT = ds.Tables(2).Rows.Count
ROW_COUNT = 3
'Me.Close()
'ROW_COUNT = 3
dlgPrintPreview.Document = PreparePrintDocument()
dlgPrintPreview.WindowState = FormWindowState.Maximized
dlgPrintPreview.ShowDialog()
Catch ex As Exception
WAR(ex.ToString)
End Try
End Sub
Private Function PreparePrintDocument() As PrintDocument
Dim print_document As New PrintDocument
AddHandler print_document.PrintPage, AddressOf Spare_Print_PrintPage
Return print_document
End Function
Private Sub Spare_Print_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles Spare_Print.PrintPage
Try
g = e.Graphics
DB()
g.DrawString(COMNAME, CNAME, brush, New Point(300, 25))
g.DrawString(DEALER, DNAME, brush, New Point(350, 50))
g.DrawString(ADD1 + " " + ADD2 + " " + CITY, FNT, brush, New Point(100, 70))
g.DrawString("Phone : " + PHONE + " " + "Mobile : " + MOBILE, FNT, brush, New Point(100, 90))
g.DrawString("TIN: " + TIN + " " + "Dt: " + TINDATE + " " + "Area Code: " + TINAREA, FNT, brush, New Point(100, 110))
'g.DrawLine(mypen, 20, 140, 820, 140) ';//Draw Horizondal Line
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 135))
g.DrawString("*** JOB INVOICE ***", FNT, brush, New Point(300, 155))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 170))
'g.DrawLine(mypen, 20, 175, 820, 175) ';//Draw Horizondal Line
g.DrawString("To, ", FNT, brush, New Point(30, 180)) ';// Get company Address
g.DrawString("Mr." + CustName, FNT, brush, New Point(80, 200)) ';// Get company Address
Dim t As Double = 220
g.DrawString(Address1 + " " + CustCity, FNT, brush, New Point(100, t)) ';// Get company Address
t = t + 70
g.DrawString("Phone : ", FNT, brush, New Point(50, t)) ';// Get company Address
g.DrawString(CustPhone, FNT, brush, New Point(145, t)) ';// Get company Address
g.DrawString("Mobile : ", FNT, brush, New Point(370, t)) ';// Get company Address
g.DrawString(CustMobile, FNT, brush, New Point(440, t))
g.DrawString("Invoice No : ", FNT, brush, New Point(550, 200)) ';//Get company Code.no
g.DrawString(G_BNO, FNT, brush, New Point(650, 200))
g.DrawString("Date : ", FNT, brush, New Point(550, 230))
g.DrawString(G_DATE, FNT, brush, New Point(650, 230))
g.DrawString("Last KM Reading : ", FNT, brush, New Point(550, 260))
g.DrawString(KM, FNT, brush, New Point(720, 260))
'g.DrawLine(mypen, 20, 315, 820, 315) ';//Horizondal line
g.DrawString("Vehicle No : " + VechNo, FNT, brush, New Point(50, 320)) ';// Get company Address
g.DrawString("Make : " + Make, FNT, brush, New Point(370, 320)) ';// Get company Address
g.DrawString("Model : " + Model, FNT, brush, New Point(600, 320)) ';// Get company Address
'g.DrawLine(mypen, 20, 345, 820, 345) ';//Horizondal line
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 330))
g.DrawString("No", FNT, brush, New Point(40, 350)) ';//
g.DrawString("Particulars", FNT, brush, New Point(150, 350))
g.DrawString("Amount", FNT, brush, New Point(670, 350))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 365))
'g.DrawLine(mypen, 20, 375, 820, 375) ';//Horizondal line
'Data_Adapter()
Dim yy, zz As Integer
Dim Qty As Decimal
x = 125
y = 380
y1 = 380
' MsgBox(ds.Tables(2).Rows(1).Item(1).ToString())
'MsgBox(dt.Rows.Count)
originalx = x
'ROW_COUNT = ds.Tables(2).Rows.Count
Dim rw, col As Integer
rw = ds.Tables(2).Rows.Count - 1
col = ds.Tables(2).Columns.Count - 1
' zz = dt.Rows.Count
For yy = 0 To PER_PAGE
If ROW_COUNT = INCR Then
GoTo CC
End If
For zz = 0 To col
Masktxt.Text = Sno.ToString 'FOR SNO
char_count = Masktxt.Text.Length
If char_count = 4 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(10, y1))
ElseIf char_count = 3 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(21, y1))
ElseIf char_count = 2 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(32, y1))
ElseIf char_count = 1 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(40, y1))
Else
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(10, y1))
End If
'g.DrawString(Sno.ToString() + ".", FNT, brush, New Point(65, y1))
If COUNT = 1 Then 'JOB NAME
g.DrawString(ds.Tables(2).Rows(INCR).Item(zz).ToString(), FNT, brush, New Point(100, y))
ElseIf COUNT = 2 Then 'AMT
'g.DrawString(ds.Tables(2).Rows(INCR).Item(zz).ToString(), FNT, brush, New Point(630, y))
Qty = ds.Tables(2).Rows(INCR).Item(zz).ToString()
Masktxt.Text = Format(Qty, "#.00")
char_count = Masktxt.Text.Length
If char_count = 10 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(640, y))
ElseIf char_count = 9 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(650, y))
ElseIf char_count = 8 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(660, y))
ElseIf char_count = 7 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(672, y))
ElseIf char_count = 6 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(683, y))
ElseIf char_count = 5 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(693, y))
ElseIf char_count = 4 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(705, y))
Else
Masktxt.Text = Format(Qty, "#")
g.DrawString(Masktxt.Text, FNT, brush, New Point(620, y))
End If
TOT += Qty
End If
COUNT += 1
Next
y += 25 ';//Next Column
y1 += 25 ';//Next Colum
COUNT = 1
Sno += 1
INCR += 1
Next
CC:
GrandTot = Round(TOT)
MaskVATToT1.Text = Format(GrandTot, "#.00") 'ROUND AMT
MaskVATToT2.Text = Format(TOT, "#.00") 'TOT AMT
char_count = MaskVATToT2.Text.Length
If char_count = 10 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(638, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(638, 920))
ElseIf char_count = 9 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(650, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(650, 920))
ElseIf char_count = 8 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(660, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(660, 920))
ElseIf char_count = 7 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(672, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(672, 920))
ElseIf char_count = 6 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(683, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(683, 920))
ElseIf char_count = 5 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(694, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(694, 920))
ElseIf char_count = 4 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(706, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(706, 920))
Else
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(638, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(638, 920))
End If
'g.DrawLine(mypen, 20, 950, 820, 950) ';//Horizondal line
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 860))
g.DrawString(RupeesToWord(Val(MaskVATToT1.Text)), FNT, brush, New Point(50, 955))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 935))
'g.DrawLine(mypen, 20, 980, 820, 980) ';//Horizondal line
g.DrawString("For,", FNT, brush, New Point(560, 1000))
g.DrawString("(" + COMNAME + ")", FNT, brush, New Point(580, 1070))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 970))
'g.DrawLine(mypen, 20, 870, 820, 870) '//Horizondal line
g.DrawString("Total", FNT, brush, New Point(530, 880))
g.DrawString("-------------------------------------------------", FNT, brush, New Point(585, 900))
'g.DrawLine(mypen, 585, 910, 820, 910) ';//Horizondal line
g.DrawString("Grand Total", FNT, brush, New Point(470, 920))
RESET()
' If we have more paragraphs, we have more pages.
PAGE_LIMIT = ROW_COUNT - INCR
If PAGE_LIMIT > 0 Then
'Reset()
e.HasMorePages = True
Else
e.HasMorePages = False
End If
Catch ex As Exception
WAR(ex.ToString)
End Try
End Sub
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Please format your code properly and rephrase your question into something a little more understandable, I can't quite get as to what the issue is.
Also, remove your email from your signature, unless you like spam.
|
|
|
|
|
Greetings.
First of all I am not looking for the entire code, I need your help to direct me or give some suggestions.
From VB.NET, will I be able to write a string to a word document which is already open (I can see the word doc in taskbar)? I was able to get the file name of the word doc that's in taskbar but failed to activate it or write on it.
So, from VB.NET, I need to activate or get the word doc which is up and running with a file name of "Musa.doc" and write some text to the word doc...
Any suggestion will be very helpful.
Thanks in advance.
Musa.Biralo
|
|
|
|
|
Unless there's a way in the Office tools to interact with an open doc, I fear your issue will be that the file is in use.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I need some assistance in sorting a structure array...
I am reading words from a text file and need to store them in a array:
Structure Translate
Dim English As String
Dim French As String
Dim German As String
End Structure
Dim TWord(16) As Translate
I then read the text file.. which basically goes from English, to French, to German.
So the first line in the text file is the English word YES, the second line is OUI (French) which means YES and the third is JA (German) which means YES in English as well. So what I have to do it put these ina structured array.
fs = New FileStream("TranslateC.txt", FileMode.Open, FileAccess.Read)
sr = New StreamReader(fs)
count = 0
Do While sr.Peek() >= 0
TWord(count).English = sr.ReadLine()
TWord(count).French = sr.ReadLine()
TWord(count).German = sr.ReadLine()
count = count + 1
Loop
sr.Close()
Now that I have that.. they want me to sort the english words?!? This is where I get completely lost. I found code earlier that helped me and it sorted the english words from A to Z but none of the others. So the translated words did not match up.
*** Could anyone point me to the correct location of a good tutorial on this? ***
I did the project first hand (That works!) but used jagged arrays instead:
Peronsally I like this way better but according to the project it is not HOW they wanted it done:
Imports System.IO
Public Class Form1
Dim TranslateWords(15)() As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim fs As FileStream
Dim sr As StreamReader
Dim count As Integer
fs = New FileStream("TranslateC.txt", FileMode.Open, FileAccess.Read)
sr = New StreamReader(fs)
count = 0
Do While sr.Peek() >= 0
Dim read = sr.ReadLine()
If read <> Nothing Then
Dim words As String() = read.Split(",")
TranslateWords(count) = New String() {words(0), words(1), words(2)}
End If
count = count + 1
Loop
sr.Close()
End Sub
Private Sub SortArray()
End Sub
Private Sub btnTranslate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTranslate.Click
Dim sentence As String = txtEnglish.Text
Dim splitSentence As String() = sentence.Split(New Char() {" "c})
Dim count As Integer
txtTranslated.Text = ""
If radioFrench.Checked Then
For Each word As String In splitSentence
Dim translated As Boolean
translated = False
For count = 0 To 15
If TranslateWords(count)(0).ToLower() = word.ToLower() Then
txtTranslated.Text += TranslateWords(count)(1) + " "
translated = True
End If
Next
If translated = False Then
txtTranslated.Text += word + " "
End If
Next
ElseIf radioGerman.Checked Then
For Each word As String In splitSentence
Dim translated As Boolean
translated = False
For count = 0 To 15
If TranslateWords(count)(0).ToLower() = word.ToLower() Then
txtTranslated.Text += TranslateWords(count)(2) + " "
translated = True
End If
Next
If translated = False Then
txtTranslated.Text += word + " "
End If
Next
Else
MsgBox("You must select French or German before trying to translate", MsgBoxStyle.Information)
End If
End Sub
End Class
|
|
|
|
|
Hi,
I don't know what happened here, you started explaining a nice structure (Translate) holding three strings, one for each language; later on I don't see that structure used anywhere, instead a lot of code I did not understand at first glance, anyway too much to get the required things done.
Collection classes have Sort methods: Array has a static Sort, most Lists and Dictionaries have an instance Sort() method; they all take an optional IComparer<Translate>, and that is what you need: a Compare method that understands your structure, takes the right language string, and compares two of them.
For three languages, that would mean three comparers, each of them holding some 5 lines of code (which I am not venturing to write down here as my Basic isn't very fluent, and some has to be left for you too).
BTW: I don't like your structure''s name, a structure holds data, so it is (almost) an object, don't call it a verb then. Maybe MultilingualTerm would fit.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I see what you are saying. The top of my question was basically what I was trying to do. Towards the bottom of my post is what I have written that actually works, but wasn't using a Array Structure and sorting it like the project requested. I'll have ot look up more on the IComparer.
|
|
|
|
|
I think you should look to use the overload of Array.Sort that takes an IComparer(Of T)
The comparer would look something like this (WARNING: code typed directly into the reply)
Friend Class TranslationSorter
Implements IComparer(Of Translate)
Public Function Compare(ByVal x as Translate, ByVal y as Translate) as Integer
'you will need null checks here to decide how to sort in nulls
'this will use the default sort order for strings
Return x.English.CompareTo(y.English)
End Function
End Class
Array.Sort(yourArray, New TranslationSorter)
With this approach, you could add a language property to the TranslationSorter class to make it do other languages.
On an unrelated note, StreamReader has an EndOfStream property instead of needing to do .Peek() >= 0
|
|
|
|
|
I actually found what my professor was wanting. I wasn't aware that she posted the code. She used a bubble sort for the structure array:
Private Sub bubbleSort(ByRef arrayName() As Words)
Dim temp As Words
Dim numItems As Integer = arrayName.GetUpperBound(0) ' number of items in array
For passNum = 1 To numItems - 1 ' Number of passes is 1 less than number of items in array
For i As Integer = 1 To (numItems - passNum) ' Each pass needs 1 less comparison
If (arrayName(i - 1).English > arrayName(i).English) Then
temp = arrayName(i - 1)
arrayName(i - 1) = arrayName(i)
arrayName(i) = temp
End If
Next
Next
End Sub
|
|
|
|
|
FYI, you do not need to pass the array ByRef to the function. Passing the array ByVal will still allow you to sort the array and have the effects noticed in the original function. Passing an array ByRef would only be useful if you were going to replace the entire array with another array. For example, if you were somehow trimming the array in a function, you would need to pass ByRef.
I'm assuming that the bubble sort was part of the assignment, but otherwise would still recommend using Array.Sort
|
|
|
|
|
Interesting... well the bubble sort is not part of the assignment. She just gave us that. It just says to "Sort" it. To be honest.. I'll have to read more on the IComparer because I don't fully understand it.
|
|
|
|
|
Hi,
a class implementing IComparer basically says Ï have a method Compare() that knows what the relative order would be of two objects of a given type; it will return zero when order is irrelevant (i.e. both objects are equal), a negative value if object1 should preceed object2, and a non-zero positive one if object1 should follow objects2."
So basically an integer Compare() method could just return the difference of both numbers; and a simple string compare method is obviously available in the string class.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi
I'm writing a program that has a ListBox control. If the user drags a file and drops it on the listbox, the filename should be added to the list. I'm using the following code:
Private Sub ListBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub ListBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop
Stop 'This is called
Dim s$ = e.Data.GetData(DataFormats.FileDrop, True) 'Why does this exit the sub?
Stop 'This not
'...
End Sub
As you can see, I put 2 stop statements in the DragDrop event. The first of them is called and stops debugging, but then e.data.getdata somehow exits the sub, and so nothing happens.
Is it even possible that a procedure exits the sub it is called from (without exiting the thread)???
I'm very confused ; I would be grateful to anyone who could give me an explanation for this.
|
|
|
|
|
What on earth is a stop statement - never used one never even heard of one.
Why not just use a breakpoint and inspect the content of e.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I'm glad you made that reply. I was going to say exactly the same, but as I do not do much VB it might have passed me by and I didn't want to appear dumb.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Yeah, just got into the office and about to fire up VB/MSDN to find out what. I used VB since the early 90's (I now use C#) and have never used a stop statement.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|