|
Yeah I tried that and now I am getting an error during debugging. The error says: Object reference not set to an instance of an object. It is during the MyArray = DefArr.IndxArr; step
Here is the code:
namespace Assignment_1
{
public partial class Form_CreateArray : Form
{
public Form_DefineArray DefineArray;
int[,] MyArray;
public Form_CreateArray()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form_DefineArray DefineArray = new Form_DefineArray();
DefineArray.ShowDialog();
}
private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button4_Click(object sender, EventArgs e)
{
MyArray = DefineArray.IndexArray;
if (DefineArray.IndexArray == null)
{
MessageBox.Show("Sorry, no array to display");
return;
}
string output = "";
for (int i = 0; i < MyArray.GetLength(0); i++)
for (int j = 0; j < MyArray.GetLength(1); j++)
output += "Element[" + i.ToString() + "," + j.ToString()
+ "] = " + MyArray[i, j].ToString() + "\n";
MessageBox.Show(output);
}
}
}
|
|
|
|
|
Acording to email I Got from you, did you clicked that button: button_CreateNewArray, since there you have created instance of Array. Put a breakpoint on Close() in second form and then look if in Quick Watch if Index array is populated. I can help you in about a hour, then I will be home ready to test your sample
|
|
|
|
|
Thanks I will try this, one question, which variable in the code do I add the watch too?
|
|
|
|
|
Whell aray of course, then use step out. Then you will land outside DefineArray.ShowDialog().
After that look in a quick view, if that Array has any walues
|
|
|
|
|
Yes the array contains all the data.
|
|
|
|
|
I want to know how can I save the NumericUpdown decimal value in windows registry and how to read it back to the NumericUpDown??
Note: I don't want to save it as String inthe registry
|
|
|
|
|
RegistryKey.Setvalue method takes in object for the value. Hence you should be able to save decimal directly to it. While getting it back, you can use the Key you set to retrieve the value and set that to NumericUpDown .
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
SetValue is not working with decimal.. when I save 0.548 it will save as 0 in a DWord format because DWord will only accept integer?
|
|
|
|
|
Well then, AFAIK, string is the only option you have.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
what baout saving it as binary? how can I do that?
|
|
|
|
|
How about to multiply your val?
Greetings
Covean
|
|
|
|
|
jrahma wrote: I want to know how can I save the NumericUpdown decimal value in windows registry and how to read it back to the NumericUpDown??
Reading from the registry and writing is done over the Registry classes.
jrahma wrote: Note: I don't want to save it as String inthe registry
The registry has no "decimal" datatype, AFAIK.
I are Troll
|
|
|
|
|
Why would you want to? I'd store it in a file.
The Registry is evil!
|
|
|
|
|
One of the design goals of .NET is to avoid using Registry. What prevents you from storing you settings in a settings file ?
|
|
|
|
|
now what if i still want to use the Registry?!
|
|
|
|
|
Then you are going against the design goals of the language you are coding in. Up to you, but not recommended.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
This coding is in C++\CLI:
System::Drawing::Bitmap ^pBitmap;
System::IntPtr intPtr = pBitmap->GetHbitmap();
//How to convert this IntPtr to HBITMAP
//HBITMAP hbitMap = intPtr
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
vibindia wrote: This coding is in C++\CLI
So why are you asking in C# forum when there is a C++ forum here?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi All,
I have developed a c# product,when i want to sale my product in cd's,how can i give licence key for my product.i dont have any basic idea about this process.please guide me for this,im really new to this windows app's.pls help me.
Thanks& Regards
Happy
Happy
|
|
|
|
|
You are new to Windows apps and you already have a product, really great.
|
|
|
|
|
Buy an application that protects yours. Such software can be found here[^], for example.
You could also pick up a book on programming, learn for a few weeks and try to build one yourself. The basic idea is to generate a number that's unique for the combination of a product/computer/user. If the registered key is different from your computed value, you're either dealing with an unregistered key, or a bug
I are Troll
|
|
|
|
|
Hi,
I'm creating a user control that displays a DataGridView control. I want to be able to programmatically select multiple cells/rows. So i made this function:
public bool SetSelectedValues(string ColumnName, List<object> CellValues)
{
bool FoundRows = false;
for (int ColumnIndex = 0; ColumnIndex < gridData.Columns.Count; ColumnIndex++)
{
if (gridData.Columns[0].Name == ColumnName)
{
gridData.ClearSelection();
for (int RowIndex = 0; RowIndex < gridData.Rows.Count; RowIndex++)
{
foreach (object CellValue in CellValues)
{
if (gridData.Rows[RowIndex].Cells[ColumnIndex].Value.ToString() == CellValue.ToString())
{
gridData.Rows[RowIndex].Cells[ColumnIndex].Selected = true;
gridData.CurrentCell = gridData.Rows[RowIndex].Cells[ColumnIndex];
FoundRows = true;
}
}
}
break;
}
}
return FoundRows;
}
It doesn't work, only the last cell gets selected, because i cannot select multiple cells in the CurrentCell. How can i solve this?
Regards,
Willem
|
|
|
|
|
I don't the code here setting MultiSelect as true. See if you have done that. Plus, not sure about CurrentCell thing. Why are you setting it in first place?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Found the solution myself, the setting of selected cell's is only effective after the datasource is bound to the control. This is not done jet when you are in the Form_Load, so you have to wait for it. This is my solution:
private string Selection_ColumnName = null;
private List<object> Selection_CellValues = null;
public void SetSelectedValues(string ColumnName, List<object> CellValues)
{
Selection_ColumnName = ColumnName;
Selection_CellValues = CellValues;
gridData.DataBindingComplete += new DataGridViewBindingCompleteEventHandler(gridData_DataBindingComplete);
}
private void gridData_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
bool CellFound = false;
for (int ColumnIndex = 0; ColumnIndex < gridData.Columns.Count; ColumnIndex++)
{
if (gridData.Columns[0].Name == Selection_ColumnName)
{
gridData.ClearSelection();
for (int RowIndex = 0; RowIndex < gridData.Rows.Count; RowIndex++)
{
foreach (object CellValue in Selection_CellValues)
{
try
{
if (gridData.Rows[RowIndex].Cells[ColumnIndex].Value.ToString() == CellValue.ToString())
{
gridData.Rows[RowIndex].Cells[ColumnIndex].Selected = true;
if (!CellFound) gridData.CurrentCell = gridData.SelectedCells[0];
CellFound = true;
}
}
catch
{
}
}
}
break;
}
}
gridData.DataBindingComplete -= new DataGridViewBindingCompleteEventHandler(gridData_DataBindingComplete);
}
|
|
|
|
|
Hi,
I am trying to retrieve mails from a server like gmail. I have used TcpClient class to connect to the server.Connection is established successfully.During authentication using SslStream.AuthenticateAsClient() method to authenticate..I receive an exception saying..(HandShake Failed due to unexpected packet format)..
Can anyone help me with this..
Thank you.
|
|
|
|