|
yes, the TextChanged event would work, however it might hamper the GUI as it would fire on every keystroke; when the web page becomes complex, rendering it might take 100 msec or more and slow down the GUI. If it becomes a nuissance, you might introduce a Windows.Forms.Timer with an Interval of say 300 msec; the Timer should get started or restarted in the TextChanged event, and its Tick handler would stop the timer and copy the text from TB to WB.
The Color.ToArgb() method turns a color into a 32-bit integer; and Int32.ToString("X8") turns a 32-bit integer into an 8-digit hex string.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
THANK YOU so much, The Form1 Works as expected now! w00t w00t!! Thank-You for all your help. And I don't think I will use a timer, because it isn't planned for huge projects. Just a starter program. If it does become like you said though, I will then implant a timer in it. Thanks. Also thanks for the help with Form2 too!!
|
|
|
|
|
How would I code the "Int32.ToString("X8")"... This is what I have so far...
If TextBox1.Text = "" Then
Button1.Text = "Choose Color"
TextBox1.Text = ColorDialog1.Color.ToArgb.ToString
TextBox1.BackColor = ColorDialog1.Color
ElseIf TextBox2.Text = "" Then
Button1.Text = "Choose Another"
TextBox2.Text = ColorDialog1.Color.ToArgb.ToString
TextBox2.BackColor = ColorDialog1.Color
ElseIf TextBox3.Text = "" Then
TextBox3.Text = ColorDialog1.Color.ToArgb.ToString
TextBox3.BackColor = ColorDialog1.Color
ElseIf TextBox4.Text = "" Then
TextBox4.Text = ColorDialog1.Color.ToArgb.ToString
TextBox4.BackColor = ColorDialog1.Color
ElseIf TextBox5.Text = "" Then
TextBox5.Text = ColorDialog1.Color.ToArgb.ToString
TextBox5.BackColor = ColorDialog1.Color
ElseIf TextBox6.Text = "" Then
TextBox6.Text = ColorDialog1.Color.ToArgb.ToString
TextBox6.BackColor = ColorDialog1.Color
ElseIf TextBox7.Text = "" Then
TextBox7.Text = ColorDialog1.Color.ToArgb.ToString
TextBox7.BackColor = ColorDialog1.Color
ElseIf TextBox8.Text = "" Then
TextBox8.Text = ColorDialog1.Color.ToArgb.ToString
TextBox8.BackColor = ColorDialog1.Color
ElseIf TextBox9.Text = "" Then
TextBox9.Text = ColorDialog1.Color.ToArgb.ToString
TextBox9.BackColor = ColorDialog1.Color
ElseIf TextBox10.Text = "" Then
TextBox10.Text = ColorDialog1.Color.ToArgb.ToString
TextBox10.BackColor = ColorDialog1.Color
Else
TextBox1.Text = ""
TextBox1.BackColor = Color.White
TextBox2.Text = ""
TextBox2.BackColor = Color.White
TextBox3.Text = ""
TextBox3.BackColor = Color.White
TextBox4.Text = ""
TextBox4.BackColor = Color.White
TextBox5.Text = ""
TextBox5.BackColor = Color.White
TextBox6.Text = ""
TextBox6.BackColor = Color.White
TextBox7.Text = ""
TextBox7.BackColor = Color.White
TextBox8.Text = ""
TextBox8.BackColor = Color.White
TextBox9.Text = ""
TextBox9.BackColor = Color.White
TextBox10.Text = ""
TextBox10.BackColor = Color.White
TextBox1.Text = ColorDialog1.Color.ToArgb.ToString
TextBox1.BackColor = ColorDialog1.Color
End If
10 textboxes for use with 10 colors... And if they choose another, it would reset the textboxes to default state, then post the new color in the first textbox. Please help me finish, Thank-You!!
|
|
|
|
|
Can I removе repeating series space in string and to stay only one space
|
|
|
|
|
Hi,
one way to do it is by having a loop that:
1. takes the length of the string
2. replaces two spaces by one
3. takes the length of the new string
4. loops to (1) if the length has changed
If large sequences of spaces occur, you can also replace a larger number of them in one shot (insert this between steps 1 and 2).
Alternatively, you could use Regex to replace multiple spaces by one space.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Yes this work. thank You very much
|
|
|
|
|
The easiest way to do this is to call string.Replace(" ", " ") until you can't find a double space in the string, which you could check in a while loop
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
If someone has experienced please help with the following:
I need to save path to image using nini (http://nini.sourceforge.net)
So everything works except the path from OpenFileDialog
The code is:
Imports System.Diagnostics
Imports Nini.Config
Imports System.IO
Public Class CompanySetup
' Inherits System.Windows.Forms.Form
Public Shared fileBanner As String
Private sourc As IniConfigSource
Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
With bannerFile
.CheckFileExists = True
.ShowReadOnly = False
.Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg"
.FilterIndex = 2
If .ShowDialog = DialogResult.OK Then
bannerBox.Image = Image.FromFile(.FileName)
fileBanner = bannerFile.FileName.ToString
End If
End With
End Sub
sourc.Configs("General").Set("Imgpic", strimg)
sourc.Configs("General").Set("CoName", txtCoName.Text)
sourc.Configs("General").Set("Imgpic", fileBanner)
sourc.Configs("General").Set("Addr", txtAddr.Text)
sourc.Configs("General").Set("Phone", txtPhone.Text)
sourc.Configs("General").Set("Fax", txtFax.Text)
sourc.Configs("General").Set("Email", txtEmail.Text)
sourc.Configs("General").Set("Vat", txtVat.Text)
sourc.Configs("General").Set("Btm1", txtBtm1.Text)
sourc.Configs("General").Set("Btm2", txtBtm2.Text)
sourc.Configs("General").Set("Btm3", txtBtm3.Text)
sourc.Configs("General").Set("Btm4", txtBtm4.Text)
sourc.Save()
Private Sub CompanySetup_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Load the configuration source file
sourc = New IniConfigSource("dvinv.ini")
'sourc.CaseSensitive = False
' Set the config to the Logging section of the INI file.
Dim config As IConfig
config = sourc.Configs("General")
' Load up some normal configuration values
txtCoName.Text = config.Get("CoName")
fileBanner = config.Get("Imgpic")
' MsgBox(config.Get("Imgpic"))
Try
bannerBox.Image = Image.FromFile(fileBanner)
Catch ex As Exception
End Try
txtAddr.Text = config.Get("Addr")
txtPhone.Text = config.Get("Phone")
txtFax.Text = config.Get("Fax")
txtEmail.Text = config.Get("Email")
txtVat.Text = config.Get("Vat")
txtBtm1.Text = config.Get("Btm1")
txtBtm2.Text = config.Get("Btm2")
txtBtm3.Text = config.Get("Btm3")
txtBtm4.Text = config.Get("Btm4")
End Sub
No key value Imgpic changes in .ini file!
Please help.
|
|
|
|
|
I got a test register source code from other friend
but I want to change register check fuction disable
How to change return value ?
I have changed some ... plz help to finish .
garnett
modified on Monday, November 16, 2009 9:49 AM
|
|
|
|
|
I don't understand your question, and I think it might be a translation issue.
I will however advise you that no one will download your entire source code and go through it for you doing your work, you will have to pay to have that kind of help.
However if you are stuck on a specific issue, which I think you might be, please post a clear, concise message detailing the issue at hand so we can guide you in the right direction.
|
|
|
|
|
wgarnett wrote: I got a test register source code from other friend
but I want to change register check fuction disable
How to change return value ?
I have changed some ... plz help to finish .
Sounds like you're doing homework ? It also sounds like you need to read some basic programming texts. You change the return value inside a method, by returning the value you want. You change the type of the return value by changing the method signature.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I am developing a project which gives excel files as output. I have tested this application on three different machines.
Out of three, on one machine files gets created with size in kbs. which is correct. other two machines generate same files with size in mbs.
for example
one file say abc.excel which contains only 3 records gets generated on machine with size 24kb, but the same file on other two machines gets genreated with size 2016kb.
What could be the possible reason?
Please help.
Thanks in advance.
|
|
|
|
|
Are they all running the same version of Excel?
|
|
|
|
|
Yes, all the machines have ms office 2007.
|
|
|
|
|
How are the files being generated?
Is the server machine doing the generation and then simply pushing the file to the client?
Is the server machine generating the files dependent on a bunch of options posted?
At the end of the day, if the server is doing the generation, and the request is identical from each client, then the output should be the same.
If on the other hand the client are then opening a file and converting for example from a CSV file, then saving, it is possible configuration options are slightly different on the odd machine which is resulting in larger files at the client end.
|
|
|
|
|
Hi All,
How to UPDATE entries of a column in SQL database ? e.g. I have a database named "clients", with a column "payment", with following entries:
payment
-------
100
200
300
Now I want these values to be updated next time when i calculate the new values that has to updated in the payment column.e.g. new values will be 500, 800, 900.
I have used following commands to update the entries:
cmd = New SqlCommand("Insert Into clients([Payment])Values(@calpay)", con)
cmd.Parameters.AddWithValue("@calpay", PaymentValue)
Where "PaymentValue" are the new values calculated.
Using the above code I found that the values are getting added below the old one, these new values doesnt replace the old values in column... I am getting finally :
payment
-------
100
200
300
500
800
900
Please help me with a piece of code. I think we have to use :
cmd = New SqlCommand(UPDATE clients SET... WHERE...
Kindy suggest me how to go ahead with this?
Thanks
R.S
|
|
|
|
|
Hi all,
I have published an application, when installed is in start-->programs-->Company Name(name of the company i'm employed)-->Application Name.
I want to publish the application in start-->programs-->Application Name.
How to obtain this?
I'm not sure on which field to change in the publish menu of the application properties.
Any help will be helpful.
Thanks in Advance.
|
|
|
|
|
Okay guys so I am allowing a user to enter in values into a text box and then click a button to have them display
in a listbox. My array for saving the input from the textbox into the list box is working perfectly.
But the problem I am having is that I know my code for displaying the array's indexices(elements) is not correct at all
I know there has to be a smarter way of doing this but I am lost, PLEASE HELP!!!!!! I COMMENT THE PART I NEED HELP WITH
Private Sub btnCal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCal.Click
'Variables
Dim StrArr() As String
Dim Str As String
Dim count As Integer
Dim lblStack() As Label
Dim i As Integer
Str = txtInput.Text 'store string into variable
StrArr = Str.Split(" ") 'use split to seperate words by space
For count = 0 To StrArr.Length - 1
'add user entered values to list box
lstDisplay.Items.Add(StrArr(count))
Next 'end for
count = 0 'set counter back to 0
For i = 0 To StrArr.Length - 1
lblDis1.Text = StrArr(0) 'gets the first value from the array
lblDis2.Text = StrArr(1) 'gets the second value from the array
lblDis3.Text = StrArr(2) ' and so on and so on...........
lblDis4.Text = StrArr(3)
lblDis5.Text = StrArr(4)
Next 'OKAY THIS IS WHERE I KNOW IF THE USER ENTER ONLY 3 VALUES IN THE TEXT BOX MY PROGRAM WOULD CRASH
'BECAUSE THE ARRAY ONLY HAS 3 ITEMS BEING STORED IN (0)(1)AND (2) SO WHAT IS A BETTER WAY OF
'DOING THIS LOOP AND SENDING OUT EACH ELEMENT TO THE LABELS.
End Sub
|
|
|
|
|
Your basic issue is that you have a dynamic array and a static number of labels. This means you have an upper limit to the number of items you can accept, which you do not enforce. Creating the labels dynamically might make more sense.
Your for loop is ridiculous. You don't use i anywhere in the loop, it's just a waste of time. You COULD built an array of label controls, so that you can step through the correct number of strings, so long as it's not more than the number of labels, and use a loop that way. You could even write some code that goes through the controls collection of the form and dynamically builds a list of how ever many labels you happen to put on there, if you like.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
PAguilar09 wrote: For i = 0 To StrArr.Length - 1 lblDis1.Text = StrArr(0) 'gets the first value from the array lblDis2.Text = StrArr(1) 'gets the second value from the array lblDis3.Text = StrArr(2) ' and so on and so on........... lblDis4.Text = StrArr(3) lblDis5.Text = StrArr(4) Next
PAguilar09 wrote: For count = 0 To StrArr.Length - 1 'add user entered values to list box lstDisplay.Items.Add(StrArr(count)) Next
1. Why are you displaying same thing twice in the UI? Even if you need to, why not have a single loop instead of two.
2. How did you decided the number of labels when at design time you don't know how many will be required?
3. Why do you bother to set count as 0 after the loop? I don't see you using it anymore. Declare that inside for loop itself.
4. Why do you need variable Str when you can directly split the textbox text?
5. In the second loop, you are not using "i" anywhere.
For adding text to the listbox, I would use following code (c#):
listBox.Items.AddRange(this.textBox1.Text.Split(new char[1] { ' ' }));
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Ok let me explain again what I am trying to figure out how to do.
I know my code that I have for a label array is incorrect. I am trying to find out how i can
write code for this:
for i = 0 to array.getupperbound(0)
'then for each element in the array i want to push it out into a label that will display
'that single value, then get the next element in the array push it out into another label
'to display and so on and son until it has reach the end of the array
next
|
|
|
|
|
You still have the problem that the number of items will not match the number of labels and will crash at some point because of that. This is why controls such as the listbox exist.
Why bother populating labels when you already have the data in a listbox?
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Its because it is a program for a programming course, I need to show a visual representation of stacks, thus why I thought i could just pop each element(indexice) from the array into a label, but i had heard of some type of label array that allows you to populate each individual label with the values from the array, without doing it the way i was passing the data to each label individualy.
|
|
|
|
|
Why not add a label at runtime?
Private Sub btnCal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCal.Click
Dim StrArr() As String
Dim Str As String
Dim i As Integer
Str = txtInput.Text
StrArr = Str.Split(" ")
For i = 0 To StrArr.Length - 1
'Add a label at runtime
Dim MyLabel As New Label
Me.Controls.Add(MyLabel)
With MyLabel
.Left = 100
.Top = 50 + i * 20
.Visible = True
End With
MyLabel.Text = StrArr(i) 'gets the first, second etc value from the array
Next
End Sub
Sigurd Johansen
|
|
|
|
|
Hey Sigurd Johansen, THANKS the code worked perfectly! I have one question what would i need to change to display the labels like this:
So user enters into a textbox this: 1 2 3 4 5 6 then he hits the calculate button
once it is clicked display the labels at runtime like this:
6
5
4
3
2
1
Thanks for the help
|
|
|
|