|
Hello still nothing cannot solve this problem, so what i tried is i tried declare variable as a (public int nameOfInteger) just before the method, in the begining oif the class and everywhere else. Still confused
thats my code
namespace ExerciseInt
{
public partial class Form1 : Form
{
int newNumber;
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
Random myRandom = new Random
myNumber = myRandom.Next(1,10);
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(myNumber.ToString());
}
}
}
so when i click button1 variable should be set up and when click button2 i would like to see this variable in the message box.
looking forward to hear from you.
|
|
|
|
|
Are you using some IDE? It would be helpful if you could give some error reports and I think I could think of one. Now, that would be newNumber and myNumber. Are those supposed to be the same? I think so.
I came, saw, and then coded.
|
|
|
|
|
Your problem is working out the SCOPE of your variable.
If you declare it in the method it dies when the method completes.
if you declare it provate in the form (I ususally put them just before the form_load method) then the variable will be available until you close the form.
public clsLimitValue oValue { get; set; }<br />
private BindingSource oBS = new BindingSource();<br />
<br />
private void frmNewLimit_Load(object sender, EventArgs e)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
maybe this[^] will inspire you.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
how can i develop a program in aspx format and use it in php site?!!
i want to write a custom search box with C#, and use it in a php site!!
any help would be useful
Thanks
modified on Thursday, July 16, 2009 3:04 AM
|
|
|
|
|
You might get a better response in the ASP forum.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Hi I'm new to C# and graphics programming so I hope you can bear with me.
We developed an application for winxp(embedded) and we added usercontrol 3D buttons in it.
I used blending and linear gradient functions instead of displaying a bitmap file.
The performance was ok when run from our workstation but it was
poorly responding when tested on the actual unit, probably because of low video
acceleration, the previous system used LabView graphics and it was doing fine with
the same 3d look. There are screens that display about 20 buttons at once.
I tried enabling double buffering but it did not change anything. Please help.
My questions are:
1. Is there any other way to create 3d buttons?
2. Would creating Direct3d usercontrol for the buttons be faster?
Thanks for your time.
|
|
|
|
|
Just a follow-up question to my inquiry.
Has anyone tried creating custom 3d button user control
using Managed Direct3d?
Thanks.
|
|
|
|
|
Hey I am C# web application developer i want to make use of the hotkeys F2 F3, and these things. I know the values for each button but i do not know how to use them in the whole page. I know how to work with it using textbox event i get the event.keyCode and work through it. What I want is that the user could have his focus on any part of the web page once he enters F2 or these button an event would be executed. How this could be done???? Thanks
|
|
|
|
|
when we open IE, we will see the standard buttons like Back, Forward, Refresh, History, Mail etc., in the toolbar window, how can I add an extra button using c#?
|
|
|
|
|
I want to run this type of query in c# how i do please tell me.
select empid,sysdte from timemgmt,if the select returns 0 rows then insert row else don't insert.
|
|
|
|
|
Did you tried anything to implement it ?
|
|
|
|
|
No I not tried to implement any thing.
|
|
|
|
|
Try the sample code
SqlConnection con = new SqlConnection("your connection string");
SqlDataReader dr;
string str = "your query";
SqlCommand cmd = new SqlCommand(str, con);
dr = cmd.ExecuteReader();
if (dr.HasRows== false)
{
}
Regards,
Karthik K...
|
|
|
|
|
I Am using oracle database
using same codeing???
|
|
|
|
|
For Oracle, replace SqlConnection,SqlCommand,SqlDatareader to odbcConnection,odbccommand and odbcdatareader
odbcConnection con = new odbcConnection("your connection string");
odbcDataReader dr;
string str = "your query";
odbcCommand cmd = new odbcCommand(str, con);
dr = cmd.ExecuteReader();
if (dr.HasRows== false)
{
}
Regards,
Karthik K...
|
|
|
|
|
Yes I M doing Same But give error
'Microsoft.Data.Odbc.OdbcDataReader' does not contain a definition for 'HasRows'
|
|
|
|
|
Then instead of Hasrow,use like this
replace the below code
if (dr.HasRows == false)
{
}
new code
if (!dr.Read())
{
MessageBox.Show("No records");
}
else
{
MessageBox.Show("Records Found");
}
Regards,
Karthik K...
|
|
|
|
|
Sir When I Use Ur Above Coding In my Aplication show error
Error Is
'Microsoft.Data.Odbc.OdbcDataReader' does not contain a definition for 'HasRows'
|
|
|
|
|
mjawadkhatri wrote: No I not tried to implement any thing.
Why not.
What are you going to run the select against, a List<> or datatable/view. You can use Linq or Rowfilter for the first part and the second is standard CRUD work.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i want to do Accept employee ID in one time in a day 2nd time user give same Id in a same date not accepted.
this is my coding
string MyString;
MyString = "Select * from timemgmt";
if (radioin.Checked == true)
{
cn = new OdbcConnection("Driver={Microsoft ODBC for Oracle};Server=orcl;UID=it;PWD=cr;");
cmd = new OdbcCommand(MyString, cn);
cn.Open();
cmd.CommandText = "insert into timemgmt values('" + textBox1.Text + "','" + label19.Text + "','" + label18.Text + "','" + label18.Text + "')";
cmd.ExecuteNonQuery();
cn.Close();
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
textbox1.text = employe ID
label19.text = System Date
label18.text = System Time
|
|
|
|
|
You need to read this article on SQL Injection[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If a text file is there on desktop.
How to print that file using one of the printer installed in my system.
How to set the printer settings?
At first how can we access the printer?
|
|
|
|
|