|
i m working in c#.How to insert values in text box at run time in window application and compare it with the int.can any one tell me.any help will be appreciated.
Thamks
|
|
|
|
|
Your question isn't 100% clear: are you asking how to move values from a number (say an int ) to a TextBox, and then back from a TextBox to a number again?
If so, then:
int i = 12;
double d = 12.776;
textBoxIntegerValue.Text = i.ToString();
textBoxDoubleValue.Text = d.ToString(); You can apply formatting information in the ToString method if you need to. See MSDN[^] for more info.
To go back to a number:
int i;
double d;
i = int.Parse(textBoxIntegerValue.Text);
d = double.Parse(textBoxDoubleValue.Text);
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Thanx.But i want that how to insert values at run time in text box after debugging the program not defining a variable and inserting values in text box.Is there any function??
|
|
|
|
|
First Ur question is not appropriate
For Inserting Values into the textbox is Textbox.Text
If you can think then I Can.
|
|
|
|
|
But i want to put the values in text box after running the program.Whenever i run the program i can put any value in text box that should be assigned to any other variable.I donont want to assign the values to text box as:
Textbox.text="good";
Not like this but to insert values at run time and convert it to int and assign it to any variable,
|
|
|
|
|
if u want to assign value in textbox then use Textbox.Text
but if you want to assign value in variable then use String s = textbox.text
if u want to convert value from string to int then use Int32.Parse("string value")
Best Regard
If you can think then I Can.
|
|
|
|
|
Sorry, but that doesn't make a lot of sense to me - it is probably a language translation problem.
Could you try to explain in more detail?
Try breaking it up into stages:
"I have a TextBox on my form called textBox1"
"I want to put a value into textBox1 so I can read it"
"I want to get the value from..."
And so on?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Actaully i have put text box on form in window application. Now what i want to do that whenever program is run i can give any value in the text box.The value that i insert that time in the text box after running the program should be assigned to int. I donont want to assign the values to text box as:
Textbox.text="good";
Not like this but to insert values at run time and convert it to int and assign it to any variable,
|
|
|
|
|
Ah! I think you mean:
"I want to let the user type a value into the text box, and then convert it to a number in a variable in my program"
You can convert the TextBox content to a number at any time:
int i = int.Parse(textBox1.Text); Will convert the content to an integer and store it in the variable i.
Why is this causing a problem? What do I still not understand about your problem?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Do you mean you want your code to place a random number in the text box?
|
|
|
|
|
yes any number that i put in text box.
|
|
|
|
|
Hello,
I am writing a program which transfers music files to devices like iPod and other mp3/music player. I am done with iPod, I use ITunes library for that and able to list and sync music in device. I could find Apple device using WMI query,
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "Select * from Win32_PnPEntity Where Name Like '%Apple%'");
But I am not able to do it with other devices. Problem is I am not finding any WMI query to detect weather device is music player or portable device. I wanted to use Windows Media Player for Sync music files to music player.
Any help is appropriated.
Thanks in advance
|
|
|
|
|
Hello Everybody,
I want to know that how to send mail from localhost.
Help me.
Thanks
If you can think then I Can.
|
|
|
|
|
Questions like this can be researched quite easily by using the tools at your disposal. For example a simple Google search reveals this[^].
I must get a clever new signature for 2011.
|
|
|
|
|
Dear Sir,
I already find it but i want for local host.
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: i want for local host.
What do you mean by this?
I must get a clever new signature for 2011.
|
|
|
|
|
I want to know that how to send mail with the use of localhost without using crediential.
If you can think then I Can.
|
|
|
|
|
Hi,
The way you ask let me think you're not aware of what is localhost really.
Localhost represents you local computer. So, if you want to send mail from localhost, it means you have to have a SMTP service running on your computer.
Do you have configured a SMTP service on your computer ?
Furthermore, I don't recommend you to send mails directly from your local computer, if you are on a private ISP subscriber line. Most of antispam systems check several things when they receive messages :
1 - They check that an MX entry exist in the DNS for the mail system contacting them
2 - Some even check that the reverse DNS is giving a correct computer name
In case you try to send mail from a private DSL IP address, you have many chances to have your IP address blacklisted by major antispam databases.
But it's just a guess...
|
|
|
|
|
thanks sir
If you can think then I Can.
|
|
|
|
|
Hi,
I fetch my connection string like this:
connectionString = Properties.Settings.Default.KTReunionConnectionString;
Which works perfectly. However I want to give the user the ability to name the database and update the string. Any attempt using the method below gives a compiler message that it's read only. How do I get around this?
Properties.Settings.Default.KTReunionConnectionString = connectionString;
I've tried this, however it doesn't not update in the app.config file:
var mySettings = ConfigurationManager.ConnectionStrings[0];
var cf = typeof(ConfigurationElement).GetField("_bReadOnly", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
cf.SetValue(mySettings, false);
mySettings.ConnectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=" + databaseName + "Integrated Security=True";
Is it possible to update the connection string?
Thank you,
Glenn
|
|
|
|
|
This may seem like a great idea, but you have to consider that the app.config file sits in the same folder as your .EXE, under Program Files. The problem with this is under Vista and Win7, users only have read permissions to everything under Program Files. This means that when they run the app, they cannot update the app.config file.
Either you have to prompt for and set these things at installation time (which requires an Admin account anyway) or you have to put the settings in a file under the users profile if you're going to allow each user to have their own seperate settings.
|
|
|
|
|
That would be a reason to not use that config scheme; I always make my own config files.
|
|
|
|
|
I user win32_printer to get printer's status,like this:
ManagementObject printer = new ManagementObject(path);
printer.Get();
ret = (PrinterStatus)Convert.ToInt32(printer.Properties["PrinterStatus"].Value);
public enum PrinterStatus { Other = 1, UnKnown, Idle, Printing, Warmup, Stopped printing, Offline}
but when i shut down the printer,the return value still is Idle.
so how to get printer true status?
Thanks
|
|
|
|
|
If you're talking about determining if the printer is turned off, asleep, or what not, you really can't determine this unless the printer driver supports it. Your problem is that WMI is getting the status from the printer driver already and it's giving you what it can support.
Just because the WMI class supports all these status states does not mean that the printer driver has to support them all.
|
|
|
|
|
Hi , have a good day
I am building an application to measure the Total Internet usage ( Daily , Monthly ... )
And I am using the following code :
private NetworkInterface[] nicArr;
nicArr = NetworkInterface.GetAllNetworkInterfaces();
NetworkInterface nic = nicArr[0];
IPv4InterfaceStatistics interfaceStats = nic.GetIPv4Statistics();
lblBytesReceived.Text = interfaceStats.BytesReceived.ToString();
And it's work like charm ,
The problem is with the Value "BytesReceived" it's did't reset if I Exit my Application ,
It's Only reset if I Disable/ Enable NetWork adapters or restart my computer ,
So it would be a total mess if I want to store "BytesReceived" value in database ,
Thank you ,
P.S:
Application Plan ;
1- Start Application
2- Get BytesReceived from network adapter
3- Add BytesReceived from network adapter to BytesReceived in database
In step 3 if BytesReceived didn't reset , It would store wrong value in database
Kind regards
I know nothing , I know nothing ...
|
|
|
|