|
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
|
|
|
|
|
How about Sum.ToString() ? Or is there more that you haven't mentioned?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
You need to try something like this (assuming txtNumberToSplit contains the Number) ,
Dim strNumber As String = txtNumberToSplit.Text
lblOnes.Text = strNumber(strNumber.Length - 1)
lblTens.Text = strNumber(strNumber.Length - 2)
lblHundreds.Text = strNumber(strNumber.Length - 3)
lblThousands.Text = strNumber(strNumber.Length - 4)
lblTenThousands.Text = CInt(strNumber / 10000)
Hope this is what you were looking for.
Happy Coding.
This would be more robust
Dim strNumber As String = txtNumberToSplit.Text
If strNumber.Length > 0 Then lblOnes.Text = strNumber(strNumber.Length - 1) Else lblOnes.Text = 0
If strNumber.Length > 1 Then lblTens.Text = strNumber(strNumber.Length - 2) Else lblTens.Text = 0
If strNumber.Length > 2 Then lblHundreds.Text = strNumber(strNumber.Length - 3) Else lblHundreds.Text = 0
If strNumber.Length > 3 Then lblThousands.Text = strNumber(strNumber.Length - 4) Else lblThousands.Text = 0
lblTenThousands.Text = CInt(strNumber / 10000)
|
|
|
|
|
cheers all for the replys I forgot to update the thread
what I have done 3 fuctions but probley reduce them down to one:
Public Function Hundreds()
Dim H As Int16
H = CInt(My.Forms.Form1.lblValue.Text)
H = H \ 100
Return H
End Function
Public Function Tens()
Dim T As Int16
T = CInt(My.Forms.Form1.lblValue.Text)
T = (T Mod 100) \ 10
Return T
End Function
Public Function Units()
Dim U As Int16
U = CInt(My.Forms.Form1.lblValue.Text)
U = (U Mod 10)
Return U
End Function
thanks again for the replys
J
|
|
|
|
|
At the link below, there is an article on this site that provides code to install a program registration system, but the instructions on how to use the code is a bit vague. I posted a question following the article, but thought I may have a better chance of receiving help by posting here. Can anyone provide me with a better explanation on how to install this code into my project?
<a href="http://www.codeproject.com/KB/vb/registration.aspx">VB.NET 2003 User Registration Form (2.1)</a>
|
|
|
|
|
I haven't actually used this code, but reading the instructions, it seems quite clear to me. What is the problem you encounter?
|
|
|
|