|
The Save works only when they click on the Save button to cycle through the Material Collection class. When the control loses focus then it STORES the necessary info into the Material collection class. I figured this would be easier than cycling through each text box when the Save button was clicked and then doing something like :
if len(textbox.text)> 0 then
Store necessary info to table
end if
and then to the next textbox and so on.
My problems seems to be that the events don't fire in the sequence that I'm expecting. I can enter data into 2 or 15 text boxes and when I click on Save it always seems to handle the number of items in the collection and THEN go to at least one more textbox even though there is no data stored in it. If I enter data into just one text box then the Save routine runs before the STORE routine for the textbox and then that store routine runs and then the next textbox lost focus runs also. Not sure why?
Thanks,
Larry
|
|
|
|
|
I'm not following for some reason. That sounds awfully convoluted. Guess I'd have to look at the code.
|
|
|
|
|
Your right it is convoluted. Let me lay out part of the design specs. We are dealing with scrap material commodity selling. There will be 30-40 buyers/sellers working with the form and can make 20-30 buys/sells per hour. What makes it difficult is they want to top selling items from yesterday to show as the first item on the form today. In other words, if 3/8 inch rod traded more yesterday then today it needs to be at the top of the list. If today 5/8 inch rods sold the most then tomorow they need to be at the top of the list. So each day, the order in which the items show can change.
I can calculate total number of sales of each item and then fill the items into a label which has the name of the item and then in the labels .tag property I store the GUID for the item. Then I name each of the textboxes acrosss the screen based upon the item name.
Each item has 5 grades from Junk to New and it is possible that on one order the user can sell 20 joints of 3/8 inch rod Junk, 15 joints of 3/8 inch rod Good (B2) and 10 rods of 3/8 inch rod New.
That is why I thought the best reason is to store each entry into a text box on the Lost_focus event into a Material collection class and then save the items to the tables from that class when they click on the Save button which will also close the form and allow them to go on to the next order.
Anything anyone can come up with to make it easier will be greatly appreciated.
Larry
|
|
|
|
|
I'm not seeing the need to store the data in both a collection and in the textboxes. Why can't the data reside just in the text boxes until the Save button is clicked? Then there would be no background overhead trying to duplicate the data from the textboxes in a collection class. It sounds to me like the simpler, and possibly more robust approach would be to remove the LostFocus events entirely. When the Save button is clicked, instantiate the collection, transfer the data from the textboxes to the collection, and then store the data in the database.
|
|
|
|
|
Right, but I initially thought that I would have to cycle through EVERY textbox and if there was a value in it then store the data directly to the table then. I would be able to pick up the MaterialID from the GUID stored in the label for the row. I just thought that would be more time consuming and convoluted than this way.
But I am open for suggestions. There are a lot more textboxes on the form than just the 65 for the materials so I have to be able to prevent any others from being searched. I beleive that can be done by cycling through the textboxes on tabLOLfrm.TabPage1 and tabLOLfrm.TabPage2 and tabLOLfrm.TabPage3. I beleive that the textboxes on the container are not recognized by the form so that might be one way. I remember that VB6 had the control array feature which was much easier to utilize. I have seen a number of attempts to create a control array in VB.Net but don't know exactly how to make a simple easy way to work. I've tried about 3 diferent ways from several different sources.
Again, I appreciate your input and insight so far, any further assistance is greatly apreciated. I'm going to start working and this suggestion tonight and see what I can accomplish.
Larry
|
|
|
|
|
From your description of your form it seems to me that you might be better served by designing a user control that contains the 5 text boxes, laid out as you need them, together with any labels, if any.
Then you only need to add 13 of these user controls to something like a scroll box on your form. If nothing else it would make your code much less complex and therefore easier to read/maintain.
Fortunately those nice folks at M$ must have been thinking of you and your problem they have released Microsoft Visual Basic Power Packs 3.0[^] which contains a new control, for VB.NET anyway (I believe a similar control was available for VB 6), called the DataRepeater . The download from the above link contains full source code and Help files with some samples.
For a quick 'HowTo' take a look at DataRepeater Control For Windows Forms[^].
I have just noticed from that link that if you have installed VS2008 SP1, you should already have this control.
If you have the time, I really recommend that you, at least, take a look at the 'HowTo' as I really believe that it will help with your current project.
Good luck anyway.
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.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Dim f1 As New Font("Arial", 8.25)
Dim f2 As New Font("Arial", 8.25, FontStyle.Bold)
' f1 is ok with option strict on or off
' f2 is ok with strict on, but with off I get an overload resolution failure
The complete diagnostic is:
Overload resolution failed because no accessible 'New' can be called without
a narrowing conversion:
Public Sub New(familyName As String, emSize As Single, unit As
System.Drawing.GraphicsUnit)
: Argument matching parameter 'emSize' narrows from 'Double' to 'Single'.
Public Sub New(familyName As String, emSize As Single, unit As
System.Drawing.GraphicsUnit)
: Argument matching parameter 'unit' narrows from 'System.Drawing.FontStyle'
to 'System.Drawing.GraphicsUnit'.
Public Sub New(familyName As String, emSize As Single, style As
System.Drawing.FontStyle)
: Argument matching parameter 'emSize' narrows from 'Double' to 'Single'.
Option Strict is 'off'
Option Explicit is 'on'
Treat all warnings as errors is 'on'
If you can think then I Can.
|
|
|
|
|
Have you tried declaring your fonts with the full declaration i.e System.Drawing.Font . I have had this problem before and it was a conflict with another class that had a Font property (I tink it might have been the Excel Interops IIRC). Then try also declaring FontStyle.Bold as System.Drawing.FontStyle.Bold , just to avoid any Namespace conflicts.
Happy Coding
|
|
|
|
|
Yes i try this but nothing happen.
If you can think then I Can.
|
|
|
|
|
The error is encountered because the constructor cannot convert double to float implicitly. You need to add "F" to your font sizes in order for the constructor to determine that it is a float.
Dim f1 As New Font("Arial", 8.25F)
Dim f2 As New Font("Arial", 8.25F, FontStyle.Bold)
|
|
|
|
|
I had mistake to define my SQL Server database table with all columns with TEXT, with my DataGridView the following codes are working fine (it will show every thing with its randome order):
cmd = New SqlCommand("SELECT * FROM GuestInfoStore", con)
If con.State = ConnectionState.Closed Then con.Open()
myDA = New SqlDataAdapter(cmd)
myDataSet = New DataSet()
myDA.Fill(myDataSet, "MyTable")
DataGridView_INFO.DataSource = myDataSet.Tables("MyTable").DefaultView
In my table, there is a column FirstName, if I use:
cmd = New SqlCommand("SELECT * FROM GuestInfoStore ORDER BY FirstName", con)
I will have an error since SQL can't compare with Text column, but it is too late for me to change FirstName column back to char(50) or so ... can anyone help me on this?
Thank in-advanced
|
|
|
|
|
Curious 2009 wrote: it is too late for me to change FirstName column back to char(50)
it is never too late to fix a mistake. Things can only get worse if you don't.
You could:
- add a field with the correct type;
- automatically copy the existing field to the new one;
- gradually adapt your software, first the field producers (methods that write the field): make them write both fields; then the field consumers (the methods that read the field): make them read the new field.
- when all is done, remove the redundant field.
The alternative is a lot of ugly code, that will grow and grow over time, as you keep adding features.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
You are right & I will do as you suggested!
Thank
|
|
|
|
|
Good.
If it is a simple TEXT->VARCHAR change, I think you can tell SQL Server to do that in place, in a single step. I haven't so far, I have done similar things with MySQL.
It is trickier when more complex formatting is involved, such as string->DateTime. It is always safe to make an extra field as a backup!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I did copy & it works, I will try to find the command for simple TEXT->VARCHAR change
Thank again
|
|
|
|
|
There is a management tool SSMS, that should be able to do such operations interactively.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Following is the code sample used to display the outlook folder dialog using VB.NET
[VB.NET CODE STARTS]
Dim objOutlook As Object
Dim objOlNamespace As Object
Dim objOlFolder As Object
objOutlook = CreateObject("Outlook.Application") ' create outlook application object at the run time
objOlNamespace = objOutlook.GetNamespace("MAPI")
objOlFolder = objContactsNS.PickFolder ' displays the folder dialog
[VB.NET CODE ENDS]
http://www.mindfiresolutions.com/Open-Outlook-folder-dialog-and-select-folder-using-VBNET-896.php[^]
Cheers,
Eliza
|
|
|
|
|
Garbage. Utter garbage. And it doesn't have anything to do with the original posters problem.
|
|
|
|
|
I have created an application using biometric SDKs in VB.net 2005.
Noy I want to deploy it in windows 7 but setup is not working in windows 7. However, its working in XP and xp servers. Is there any way to create a setup for windows 7??
|
|
|
|
|
have you tried the setup by running in compatibility mode?
Right click the setup file, select properties, then the Compatibility tab............
|
|
|
|
|
Try to run it as administrator. This has helped me somethimes.
Tosch
|
|
|
|
|
Same problem I have faced few days ago. The problem was accessing registry. The Key i was looking for that is common in XP. SO I thought W7 would have that key. But W7 don't. There was no error handler. Then I add a try catch statement which solved that problem.
Ayesha.Hafeez:"I have created an application using biometric SDKs in VB.net 2005."
Try Create another app just having a simple form & try again in W7. If success your 1st app must have some error which are not handled.
|
|
|
|
|
Hello, this is Vikash Gohil.
I have a windows service that takes data from the database and does some processing on that data.
I have also added licencing functionality to the service so that people using it will require to register with us. Initially the service would run in trial period and would expire after 30 days.
Now I want the below functionality.
I want to add a User Interface in the Service which will popup when user clicks on SysTray icon of my service. This UI would allow user to Register service using a Licence file on trial period expiration.
And also when registeration form is open, i want the service to pause as i am using sleep command in my service, which will lock the UI if service is running.
Can someone provide me some idea how to do it.
Any help would be greatly appreciated.
Thanks in advance. Awaiting a reply soon.
|
|
|
|
|
You don't do this stuff in the Service. You do it in a seperate application that puts it's interface behind the tray icon and talks to the service through whatever interprocess communcation channel you like.
|
|
|
|
|
hiya im trying to make a game where a lable(at the moment) displays a value and the user has to drag numbers to add to that amount. I have four PB's 2 seperated by a +
sign and then the therd and fourth by an = sign basicly 1 + 2 = yada. in stead of the lable I want to display the value after the = sign
my idea is to seperate the value into it's tens and units but just cant think of how to do it.
if anyone can point me in the right direction I would be very greatful
sorry forgot to mention im using VS 2008
cheers
J
|
|
|
|