But, make sure you hold on to your sanity and don't become detached for reality like many of those uber-intense SO members.
Your last sentence is absolutely true. I feel like this reality detachment is slowly rising in me.
But, make sure you hold on to your sanity and don't become detached for reality like many of those uber-intense SO members.
Your last sentence is absolutely true. I feel like this reality detachment is slowly rising in me.
Tnx to all of you for replying to my post.
@Dani, I'm aware of the reward points and the money, but I can't help myself. StackOverflow (StackExchange) just took me.... Altough I think you and your team made this community so much better than it was 3 years ago not to mention the repliers who give wonderful answers.
I've started here at DANIWEB almost 3 years ago. Helped a lot of people altough most of them did not give any feedback (votes, mark question solved ect.). I must say that DANIWEB created me as a programmer in one way. I still remember spending 3 and half hours on a thread helping someone whom I don't know and eventually made a solution. These type of threads put a lot of knowledge into my mind. I would rather have spent my time solving threads at Daniweb than building some kind of project for someone or myself. Every spare time I had was given to this forum.
Things have changed, more and more projects came, university tasks which were related and non-related to programming, less time for solving online forum problems.
Going back in time, time when I actually started actively programming (4 years ago, altough first encounter was long time ago, done some html, css as a kid). Today, every thing seems so trivial (built a lot of big projects for various platforms, made "impossible algorithms for me" possible and still not thinking that I'm a great programmer and never became ridged (full of my-self) in any way, but I can definetly say that I can build things.
Sorry for the introduction and Of course, this is not what the question is about.
Someting bothers me. I ve switched to Stackoverflow, the most popular programming Q%A. Things are hard there, I believe that most of you know how things function …
Instead of
where (dtCutOffDate.Subtract(dt.Field<DateTime>("Date")).Days) >= iStartRange
&& dtCutOffDate.Subtract(dt.Field<DateTime>("Date")).Days <= iEndRange
Just add a '?' character.
where (dtCutOffDate.Subtract(dt.Field<DateTime?>("Date")).Days) >= iStartRange
&& dtCutOffDate.Subtract(dt.Field<DateTime?>("Date")).Days <= iEndRange
You should avoid the exception now.
Thank you Mike for putting so much effort to answer my question!
private void button1_Click(object sender, EventArgs e)
{
string constr = @"Data Source=PRAVEEN\\SQLEXPRESS;Initial Catalog=travelbooking;Integrated Security=True"; ;
conn = new SqlConnection(constr);
conn.Open();
cmd = new SqlCommand(@"SELECT * FROM travelregi
WHERE name=@im and password=@prezim", conn);
cmd.Parameters.Add(new SqlParameter("im", username.Text));
cmd.Parameters.Add(new SqlParameter("prezim", pwd.Text));
reader = cmd.ExecuteReader();
if (reader.HasRows)
{
reader.Read();
if (this.username.Text ==reader.GetString(0).Trim() && this.pwd.Text == reader.GetString(1).Trim())
{
MessageBox.Show("login sucessful");
}
else
{
MessageBox.Show("failed login");
}
reader.Close();
conn.Close();
}
}
If the above does not work then thid definitely should!
The problem is the mutliple readkey() method call, you have to have a storage for you readkey()...
try this
static void Main(string[] args)
{
Console.WriteLine("Press Spacebar to fire the gun. You start with 8 bullets in the mag.\n");
int i = 8;
while (true)
{
ConsoleKeyInfo info = Console.ReadKey();
if (info.Key==ConsoleKey.Spacebar)
{
i = i - 1;
Console.WriteLine("\nYou now have {0} bullets in the barrel.\n", i);
}
if (i == 0)
{
Console.WriteLine("\nYou have 0 bullets in your pistol! Hit 'r' to reload!\n");
Console.WriteLine("All you hear is a click.\n");
}
if (info.Key == ConsoleKey.R)
{
i = 8;
Console.WriteLine("You now have 8 bullets in your mag.");
}
}
}
Consider talking to your professor at school, he will definetly give you some ideas based on your knowledge... Your current knowledge is the most important thing. Don't get into something that may be too hard to solve. Of course, you can always try to make something big. Anyways you can always google what woud be good to do, what kind of app and on wich platform would be the best do develop it.
Dont want to sound too smart here but it's the same as the output from the MessageBox.Show(string) you must have a string output otherwise you'll get an error ...
For your other part I would just go and convert each element to a string
comboBox6.Items.AddRange(new int[]{1,2,3,4,5}.Select(x=>x.ToString()).ToArray());
Afters you could just convert these string to int's depending what you want to do with it...
I think you got it correct now. But your writting is only a bit incorrect if I may say so.
just adds on everytime the random number is selected.
Yes this is true in one way but the correct sentence would be that it adds everytime no matter the randomnumber. The randomnumber just defines the random index (for example when you throw the dice you don't know what number you will get, that's what the random number does, it gives a random INDEX of the array which actually represents your dice number and then adds the frequency SAYING , OK THIS NUMBER APPEARED SO JUST INCREMENT THE COUNTER OF THAT NUMBER. The counter is actually the frequency and yes you can say that there are 6 counters in your array since for each index you are incrementing a let's say special counter every time the specific number occurs.
When i was learning C i remember that i wrote down something concerning that problem
and with this writting you ll get a full understanding of it.
example1:
int y;
int x = 2;
y = x++;// or y=x=(x+1) , y stores x imediatlly and THEN x is being incremented y=2 here
y=x;// if you would go now and write this line you would see that y=3;
// with preincrement there is nothing much being explained
// first the value is incremented and thus it is stored in the variable y
int y;
y=2;
y=++x;// y=3
This is a storage problem, if you do ++x and output it and x++ and ouput it youll get same results because you didn't store them anywhere after,, eventualy they increment to +1 . Now just apply this to your array...
you will have to use another logic for you program. altough your logic is good at first if you lower your triangle (if you reduce the number of rows) then you 'll see that your solution isn't good
Click Here
for instance:
5
1 2
9 4 5
9 7 6 12
11 2 33 4 5
following your code you would do this:
5+2+5+12+5=29--> final result
but have in my mind that there are other routes as well
for instance:
take the most left route and go down
--> 5+1+9+9+11=35
35>29 --> that is your solution isn't 100% correct
try this then:
`
class Program
{
static void Main(string[] args)
{
cars.color = "blue";
cars.price = 0.2;
cars.model = "volvo";
cars.mark = "volvo";
cars.WriteInfo();
//book parameters
Console.ReadKey();
}
}
}
class cars
{
public static string mark;
public static string model;
public static string color;
public static double price;
public static void WriteInfo()
{
Console.WriteLine("cars: mark: {0} model: {1}. color: {2}. price: {3}", mark, model, color, price);
}
}
`
static void Main(string[] args)
{
string number = "12345";
int counter = -1;
string output="";
int counter2 = 0;
int pad = (2 * (number.Length-1)) + 1;
List<string> list = new List<string>();
for (int i = 0; i < number.Length; i++) // normal seqeuncial concatenation
{
output = output + number[i];
if (i == 0)
{
Console.WriteLine(output.PadLeft(pad));
list.Add(output);
}
for (int j = counter; j >=0 ; j--)// reverse concatenation
{
counter2 = output.Length;
output = output + number[j];
if (output[output.Length-1]==number[0])
{
Console.WriteLine(output.PadLeft(pad));
list.Add(output);
output=output.Remove(counter+2);
}
}
counter++;
}
list.RemoveAt(list.Count - 1);
list.Reverse();
foreach (var item in list)
{
Console.WriteLine(item.PadLeft(pad));
}
Console.ReadLine();
}
I really wanted to avoid the list stuff but I was lazy to think how to reverse inside my loops.
By the way i would really want to see Ketsuekiame to post his code if ofcourse he s got the time for it. And i m also suprised that no one used recursion xd.
I helped you and tried to figure out what you had in mind when doing it.Now you do the rest
if (ch == "1")
{
string binary;
Console.WriteLine("Enter the binary number");
binary = Console.ReadLine();
int power = 0;
int number = 0;
for (int i = binary.Length - 1; i >= 0; i--) // changed the ending state
{
if (binary[i] == '1')
number = number + (int)Math.Pow(2, power); // tried to figure out what you had in mind
power++;
}
Console.WriteLine("the decimal number is :" + number);
}
you have to concatenate, again
textBox1.Text = textBox1.Text+line;
change line 5 on your first post.
Well suppose that you ve added images to the Resources and you have them already in your Listbox. You can do this by writting the folowing code:
List<Image> list;
public Form1()
{
InitializeComponent();
list = new List<Image>();
list.Add(Properties.Resources.image1name);
list.Add(Properties.Resources.image2name);
list.Add(Properties.Resources.image3name);
//and so on...
}
private void Form1_Load(object sender, EventArgs e)
{
listBox1.DataSource = list;
}
Now that you have your Image objects in your listbox by clicking on one of them you should be able to display your image to the PictureBox by using this code.
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
pictureBox1.Image = (Image)listBox1.SelectedItem;
}
So you just generate the event and put the folowing code inside, You have to cast the items in the listbox otherwise you ll get an error.
One of the best sites to learn about the web is http://www.w3schools.com/php/default.asp
It s incredible i learned HTML, CSS, SQL, XML, learningn javascript...
It gives you a good understanding and you can also text your own code overthere without having a program installed on you harddrive.
So once again you will get a decent knowledge about php but after that in order to fully understand what s going on you will have to program by yourself and create some applications.