|
Hey everyone,
Im currently workin on a little project for work which is driving me insane! I didnt want it to come to this (asking experts for help) but i feel the project needs some fresh eyes to guide me to a better solution. So let me just outline what im trying to do;
First, we have a large list of customers on our server, approx 1316 customers. Now on our intranet webpage i wish to create a fast way of finding customers using an ASP tree. So consider a list of customer names returned from an SQL query into a large array. I then wish to check the first couple of letters of each customer, and group customers with similiar names together under one branch in the tree.
The Result would look something like this;
Customers
|
|-A
___|-ar
______-arson, pat
______-arson, mick
______-arsen, jon
______...
______...
___|-as
______-asnot, mark
______...
______...
___|-Other A's
______...
______...
|-B
___|-ba
______|-bai
__________-bailey, john
__________-bailey, mark
__________...
__________...
______|-bar
__________-barker, paul
__________-barton, mike
__________...
__________...
___|-br
______-bromich, dave
______-brockurst, mick
______...
______...
___|-Other B's
______...
______...
|-C
___-charles, john
___-chaplin, pat
______-chan, johnny
|-D
___|-da
.
.
.
....
just to explain anything with a | beside it represents a branch which has leaves while anythin with just - represents a leaf which will hold a customer name
One main important thing about this code is that i want it to be very dynamic and one important feature is groups of similar names, being grouped in their own branch. For example the code should read like;
if there are less than X names beginning with 'ar' then group these names under a branch called 'ar'
But if there are more than X names beginning with 'ar' then search again through this group and compare the first 3 letters for similarity.
This idea is shown in the B section, here the code found more than X names with -ba as the first two letters, and so and the code ran again comparing the first three letters, these groups of three letters had less hits than X and so are plotted in their own trees -bai and -bar.
I hope you can follow me now as you read this and it makes some sort of sense!
I want it to be so dynamic that lets say, we enter many customers with names starting with -bai, the program will then scan the first four letters of the name and if this is over X, it will scan the first five letters of each name, if again theres more than X it will move onto scanning 6 letters.
Thats is why i call it 'intelligent sorting' i want it to be so streamlined that you could have 200 -bai customers sorted into 5 or 6 branches, while you may have only 5 -D customers which will only fall under the -D branch!
I've been trying to do this with a simple checkltr = left(myarray(1,k),3) command and lots of array sorting, which works. but when i move onto checking 4 letters and 5 letters the code gets way too big and eventually just becomes inefficient, there has to be a way of doing this with not much code.
Please, please, please if anyone can help it would be great!
NOTE: I DONT NEED HELP WITH THE .ASP TREE, JUST WITH SORTING THE DATA!!
|
|
|
|
|
You can do this in SQL by writing a statement like this:
SELECT * FROM myTable WHERE customerName like 'BAI%'
The % is a wildcard character in SQL. The one thing to watch out for is that SQL it is case sensitive, so to search for all possiblities you'd have to uppercase the customerName first.
Hope this helps.
|
|
|
|
|
yes i know that SQL statement. But then the list sorting is not dynamic, what if lots of 'BAT' customers were added to the table, one would then have to go into the code and add the SQL statement for that!
i need to use arrays that sift through the table plucking out groups of names that have similar first letters! i just dont know the best approach!
|
|
|
|
|
You can perform some SQL to the in memory DataTable. This can be done using the .Select function on the DataTable object. It will return an array of table rows that you can loop through to load your array. So it would look something like this:
'dtMaster has all of your master data<br />
For Each myRow as DataRow in dtMaster.Select("Customer like 'BAT%')<br />
'Add myRow("Customer") to your string array<br />
Next
As I stated before, this works only if the data in your DataTable is the same case, so you may have to create a second column of the customer names and upper case it so that you can use this. I hope this helps and is what you were looking for.
|
|
|
|
|
Hi,
I want to add Windows Installer 2.0 in my VB.Net Setup for supporting at Windows 98 OS. But when i built my setup specified folder not added in Setup folder.
If any one have an idea, please help me.
Bye.
|
|
|
|
|
hello whom ever,
im creating a playlist program in vb.net. i am trying to add a file name to a list box from my documents. the thing is im almost there, the file name appears at the top of the form as the form title but i need it in the list box.
it would be greatly appreciated if you could try and help me out.
heres a snipit of the code. cheers
Me.openFileDialog1 = New System.Windows.Forms.OpenFileDialog
openFileDialog1.ShowDialog()
Dim name As String = openFileDialog1.FileName
Dim contain As String = openFileDialog1.FileName
listBox1.Text = openFileDialog1.FileName
Me.Text = name
''contain.close()
|
|
|
|
|
You have to change the following line of code.
Change: listBox1.Text = openFileDialog1.FileName
To: listBox1.Items.Add(openFileDialog1.FileName)
Have a great day.
Recreating the wheel is the best way to appreciate what the previous coders have gone through to get you where you are at now.
|
|
|
|
|
thanks matey you'll be pleased to know i figured that out not too many seconds after i posted that message, stupid me. if your not to busy i could do with a bit more help on a couple of things.
how can i assign a command to select all items in the list and how do i move up and down the list
|
|
|
|
|
Hi, I'm creating an application for outlook 2003 using VS 2005(vb.net) and VSTO 2005 SE. However I am trying to add a button to the outlook toolbar, kinda like the send recieve button and an item to the "tools" menu. However I am struggling to get anywhere with it, does anyone know of anything that could be of help?
Thanks in advance
Chris
|
|
|
|
|
I am a beginer vb6 programmer, Now i m in big trouble, my need to make a multi column combo with auto complete and have header & sorting by header...
Please Help me..!!
Please Help me..!!
Please Help me..!!
|
|
|
|
|
I've made a programme similar to the Windows Wordpad. and i want to use a msgbox to choose whether to save the text stored in richtextbox before the Form is closd
if the result of msgbox is Yes, a function 'savefile' will be called and after that the Form will be closed, if the result of the msgbox is No, the Form will be closed, and if result is Cancel, the Form will stay open.
how can I do it?
i've tried several times but it doesn't work.
please help. ~~
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
MsgBox("The Text in the file has been changed.Do you want to save it?", MsgBoxStyle.YesNoCancel, "Wordpad")
If MsgBoxResult.Yes Then
savefile()
e.Cancel = False
ElseIf MsgBoxResult.No Then
e.Cancel = False
ElseIf MsgBoxResult.Cancel Then
e.Cancel = True
End If
End If
End Sub
sync_austin
|
|
|
|
|
You need to include the message in the if statement:
If MessageBox.Show("Exit?", "Exit?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Hand) = Windows.Forms.DialogResult.Cancel Then<br />
e.Cancel = True<br />
Else<br />
e.Cancel = False<br />
End If
Alternatively:
dim result as windows.forms.dialogresult<br />
<br />
result = MessageBox.Show("Exit?", "Exit?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Hand)<br />
<br />
if result = Windows.Forms.DialogResult.Cancel then<br />
e.cancel = true<br />
elseif result = result = Windows.Forms.DialogResult.Yes then<br />
' do whatever<br />
else<br />
' do whatever<br />
end if
This way the cancel is dependant on the result.
P.S. Msgbox is old now, use messagebox.show, it's much more versatile and easier to create dialogs.
-- modified at 5:33 Tuesday 12th December, 2006
Posted by The ANZAC
|
|
|
|
|
We have have 10 VB6.0 proejcts, all the 10 projects are refered by one Main Project (Vb6.0)
Using VS2005 upgrade wizard, we have migrated only the Main Project, .net automatically created interop for the other projects.
The application (migrated application) is running smoothly .net.
But while closing the applicaiton we are getting the following error :
"unhandled exception at 0x660688 (msvbvm60.dll) in DBCenter.exe: 0xc0000005: Access violation reading location 0xfeeeffaa"
Please help us to resolve this error.
Advanced thanks
Mano
|
|
|
|
|
Can anyone offer some advise on how to improve performance (VB application, VS 2005) ...
An mdi window has a tab control that I'm using to show/hide child windows i.e. tabpage1 shows child windows 1,2,3, tabpage2 shows child windows 4,5,6 etc. I use a for loop to show the windows assigned to the selected tab and hide the ones that aren't.
However as the number of tabs & child windows grows, it becomes sluggish.
I cured this by actually assigning the child windows to the actual tabpages but then have problems maximising the child windows.
Anyone know of another solution I could try?
|
|
|
|
|
dose any one know about dos printing i want to print Barcode on epson Lq 680
code39 . need help
|
|
|
|
|
Dot matrix printers are not the best for barcodes. There dpi is too low. Having said that, to print barcodes from DOS you will need a printer module. I have purchased these in the past from Fontware
Steve Jowett
|
|
|
|
|
Hey guys need help
I have a problem encounter this Imports ReportPrinting references. I need more infomation but when i search in web not much of information being retrieve.Hope u guys can help me out. Provide me link or information on this
Thanks a millons
KaKaShi HaTaKe
|
|
|
|
|
Sir/Madam,
I have a control ,I am passing that control in another function in the following way
like if i have invoked a datagrid , it's name is dg1.
sub abc()
{
binddata(dg1)
}
binddata(byval c as control)
{
'Now i want to assign the memory of c to datagrid control
dim d as datagrid
d = c
'But the above line shows error
}
'Please help.
|
|
|
|
|
amaneet wrote: dim d as datagrid
d = c
the type of c and d is not the same so you must use type casting to convert c to DataGrid
try this
d=(DataGrid)c
Mohamad A. Flefel
mflefel@hotmail.com
+962 79 5963865
C#.net & VB.net Developer
|
|
|
|
|
I have wrote timer routine in Visual basic Editor in Ms Excel2003 in which the timer will update the values of the cells of procedure opcavgtemp automatically after each 2 minutes .
Public RunWhen As Double
Public Const cRunIntervalSeconds = 120 ' two minutes
Public Const cRunWhat = "OPCAvgtemp"
sub opcavgtemp()
'code to be executed every 2 min
StartTimer
end sub
sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, _
schedule:=True
End Sub
The problem is when Itry to migrate this macro code to VB 6.0 it show for me error , object required.
Could anyone help me please urgent ??
|
|
|
|
|
alhomed44 wrote: Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, _
schedule:=True
In VB6 you have NOT an Application object hence it complains about.
You can use a Timer control to obtain that stuff.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
how to add textbox to datagrid in winforms and display the value in it
|
|
|
|
|
Your question is somewhat vague. Would you care to elaborate?
Posted by The ANZAC
|
|
|
|
|
how to add textbox to the datagrid
|
|
|
|
|
By using datagrid view property,
Go to columns property and select what type of columns you want ie., u can add textbox,checkbox,button columns etc.
Janani
|
|
|
|