|
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 ...
|
|
|
|
|
There are two simple ways to do this:
1) Store the last-read value as an Application setting value, and subtract that from the current value from the adaptor to give you bytes-since-last-read.
2) Store the raw value in the database instead of the cumulative value, and process it afterwards.
I would probably use the second option, so my database entries would just be a DateTime and a CurrentBytes - I can then post process it when I need to, in any way I choose.
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."
|
|
|
|
|
Thank you , Sir
I think I will go with the first Option , ( Very Smart Option )
And I think the second Option will not work if the user Exit and start application many times ,
I know nothing , I know nothing ...
|
|
|
|
|
One workaround would be to make some use datetime abilities(C# or DB it self whatever you are more confortable with).
Example:
BytesReceived | DateTime
100 | 10.02.2011::16:40
198 | 10.02.2011::16:50
that would result in 98 new bytes.
I have no ideea if there is a way to Reset the Network adapter(s). And I'm too lazy for bingle.
If the newest read value it's smaller then previous value then clerly the Pc was restarted or the network adapter reset.
All the best,
Dan
modified on Friday, February 11, 2011 3:11 PM
|
|
|
|
|
Thank You Sir ,
MDL=>Moshu wrote: If the newest read value it's smaller then previous value then clerly the Pc was restarted or the network adapter reset.
I think this very important thing ,I will try some test , Looks very interesting
I know nothing , I know nothing ...
|
|
|
|
|
Hello all,
I have a jcaps web service I need to call with details of a document - this includes DateTime field which expects a Date in the format dd-MM-yyyy but I can't get my datetime to serialize in this format instead it always serializes in the format dd/MM/yyyy. This causes the web service to throw a SOAP exception.
I've tried using a new CultureInfo which is a clone of the current CultureInfo and have changed the DateTimeFormat.DateSeparator = "-" - this will survive a ToString() when I provide the new CultureInfo but when I try a DateTime.Parse() providing the string and culture info it again uses the "/" date separator.
I've also tried with ParseExact() to no avail.
Is there a way to persist CultureInfo through serialization? Or (as I'm beginning to suspect) am I barking up the wrong tree?
Thanks
Paul
ETA - Sorry should make clear the above has been attempted to see what the cultureinfo will persist across, when accessing the web service we just provide the datetime property.
|
|
|
|