|
thank you friend
it is working
with regards
prasad
|
|
|
|
|
i want to create the list box which has horizantle and vertical scroll bar in asp.net using c#
|
|
|
|
|
Ask it in the ASP.NET forum.
|
|
|
|
|
I am not sure. Try applying CSS
|
|
|
|
|
private class classStr {
public string str;
}
public void temp()
{
classStr[] objStr = new classStr[3];
objStr[0].str = "New string";
}
when i m trying to execute above code it gives error at this line
objStr[0].str = "New string";
whether i hav to type cast "New string".
error generated: Object reference not set to an instance of an object.
|
|
|
|
|
Hi
You need to create an instance for each index of an array before accessing it.
Here is an example:
classStr[] objStr = new classStr[10];
for (int i = 0; i < 10; i++)
{
objStr[i] = new classStr();
objStr[i].Var = "New String";
}
Hope this is clear.
Harini
|
|
|
|
|
You must get that error!!!
Explanation: In the function temp,
In Line 1.You are creating an array of 3 elements. So that you are allowed to store 3 objects. But remember you dont have any objects so far in any of your array position(cell).
In Line2: The first object in 0th cell of the array you are trying to access( So far you dont hav anything in 0th cell of the array and so you get the error.)
So the bottom line is .... you must assign ( or store )something in the array before accessing array element(s).
Hope this helps ...
Thanks,
Arindam D Tewary
|
|
|
|
|
|
Hello All,
I know how to close a form,
just that i need to write the same code for the windows code button, along the maximize and the minimize buttons.
How can I do that.
Thanks in advance.
Keshav Kamat
India
|
|
|
|
|
Keshav V. Kamat wrote: just that i need to write the same code for the windows code button, along the maximize and the minimize buttons.
What is the use or writting same code there ? When user clicks windows close button form will close automatically ? Then what's u r prob ?
|
|
|
|
|
Never mind. I got it. Its not as simple as it looks to be.
I wanted to delete all databases created in the project.
Earlier, a separate button used to do the trick.
But if the user fails to click the special button, then the databases wont be deleted, which will in turn pose a problem the next time i run it.
What I mean to say is before the application exits, a series of tasks/events should occur. With the windows default close button, the application simply exists. Hence I wanted to place the code of events over there.
anyways thanks.
Keshav Kamat
India
|
|
|
|
|
Form.Close();
this.WindowState = FormWindowState.Maximized;
this.WindowState = FormWindowState.Minimized;
|
|
|
|
|
thanks got it.
I wanted a series of events to happen when the user clicks the default close button.
We can directly use the form closing event to do the trick.
Keshav Kamat
India
|
|
|
|
|
I'm a beginner. I have a array of form and I want copy some element of this array to other array. I tryed, but when I start debugging, The program has a error. Do you have an other way? Pleased help me!
My code:
...
public static Form[] ListFormFull ={ new Form1(),new Form2(), new Form3(),new Form4()};
public static Form[] listFormChoose;
...
listFormChoose[i]=ListFormFull[j];//Error here
....
Thank you!
|
|
|
|
|
Dothanhnam wrote: public static Form[] listFormChoose;
You are not initializing array try something like
public static Form[] listFormChoose = new Form[4];
|
|
|
|
|
Thank you, but when I rewrite follow you, has a error :Index was outside the bounds of the array. Can you help me!
|
|
|
|
|
This means that the values of i and j that are used as array indexes are getting to big. Arrays have a null-based index, so if your array has four elements those are accessible via indexes 0, 1, 2 and 3.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I've been making a calculator that i can include in apps that may need one (for convenience)
But ive come accross a slight problem. I have it in hex mode, i type in FF, i use the not operator, i get FFFFFFFFFFFFF00. So all is good.
I do this by converting the hex FF, into a ulong (or UInt64). But when i try to use the NOT again, it goes to FFFFFFFFFFFFFFFF, this is because:
FFFFFFFFFFFFF00 = 18446744073709551360
and NOT 18446744073709551360 = -18446744073709551361
See nows there's the problem, ulong has no negatives. And im way to tired to think anymore. So any unput would be real good. Thanks.
|
|
|
|
|
How are you implementing the not operator?
The following short console program does what you want:
using System;
using System.Collections.Generic;
using System.Text;
namespace NotTest
{
class Program
{
static void Main(string[] args)
{
ulong i = 0xFF;
Console.WriteLine(i);
i = ~i;
Console.WriteLine(i);
i = ~i;
Console.WriteLine(i);
Console.Read();
}
}
}
With the output:
255
18446744073709551360
255
If you're getting negative output, it's gotta be because the unsigned long is being converted to a signed long somewhere along the way.
|
|
|
|
|
Its not my calcy that gave the negative value, that would be the windows calculator.
I'll just see if I can figure it out tomorrow. It's probably something incredible simple.
Well, must sleep now.
|
|
|
|
|
Hello everyone,
I have a String and would like to be able to pick let's say First, Second, and the Last letter and create a new string.
Can someone be kind enough to tell me how I can get this done?
Thank you so much and have a great day.
Khoramdin
|
|
|
|
|
str[0] + str[1] + str[str.Length-1]
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You can use..
String str = "abc";
foreach (char c in str)
{
// operations on letters.
}
"If our Mind can, the Program can !!"
|
|
|
|
|
Here is code that I found on page 85 of Microsoft Visual C# 2005 Step by Step, I need some further explanation on the line "current = digit + current;" This line seems to concatenate a string and char value, but the book has only a vague exlanation. Could anyone explain further? Here is the code.
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
#endregion
namespace DoStatement
{
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void showSteps_Click(object sender, System.EventArgs e)
{
int amount = System.Int32.Parse(number.Text);
steps.Text = "";
string current = "";
do
{
int digitCode = '0' + amount % 10;
char digit = Convert.ToChar(digitCode);
// on first iteration result will be 3,
// but that what current was before adding.
current = digit + current;
steps.Text += current + "\r\n";
amount /= 10;
}
while (amount != 0);
}
}
}
Steven Fried
|
|
|
|
|
netproblemsolver wrote: This line seems to concatenate a string and char value
yes, that's exactly right. You can also add a string and an int, and get a string, the framework works out that this is what you're after.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|