|
kalaveer wrote: but that initialization in the structure giving the following error
Error Field catalog_info.Name must be fully assigned before control leaves the constructor
why this error coming
Because you have to set the value of all members in the constructor. If you have no specific value for them, set them to null.
Remember that there is always a parameterless constructor for the struct, that initializes everything to 0/null.
I would suggest that you use a class instead of a struct, otherwise you can get some surprises when you start passing it around in your code. If you for example pass the struct to a method, the method will get a completely separate instance of the struct, but it still shares the same ArrayList.
---
b { font-weight: normal; }
|
|
|
|
|
Your ArrayList is default, so will be visible only within namespace (if I remember it correctly).
You should initialize the struct the same way you do it with the class. This means, you should write:
catalog_info catalogs = new catalog_info()
You can provide constructors for your struct, but not default one.
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
if i use only simple structure variable its working fine but i require structure array of 20 elements that time i got problem
so can you please tell me how to write the statement to create a structure variable with 10 elements and to call its constructor that creates my arraylist variable.
i tried like the below possible ways but none of it worked.
catalog_info [] catalogs = new catalog_info[20](10);
catalog_info [] catalogs = new catalog_info[20]();
and my structure is
struct catalog_info
{
public string format;
public string Name;
public string connction_name;
public ArrayList resourses;
public catalog_info (int i)
{
resourses=new ArrayList (i);
format = "";
Name = "";
connction_name = "";
}
}
|
|
|
|
|
You need to define 'worked'. Your code calls the default constructor, so none of your values are initialised, but it works. You could add a static method which creates your array and initialises it's members. Overall, I'd tend towards making it a class and not a struct. Anything else seems likely to be a hack.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
What about oing it this way:
catalog_info catalogs = new catalog_info(10)
Remember, struct is similar to class, not to Array.
It is value type, not a reference type, but you initialize it the same way as you do with the class
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
ListBox DataSource DisplayMember Property
Problems in C#
I have a (single select) listbox with data and
when I click on the list I can't get the right
text selected.
My listbox is setup using the DataSource property.
I set my ValueMember and DisplayMember
listBox1.ValueMember = "TypeID";
listBox1.DisplayMember = "Name";
I am able to get the "TypeID" (ValueMember) when I click on
the items.
I do that like this...
int intTest;
intTest = System.Int32.Parse(listBox1.SelectedValue.ToString ());
But I can't get the text (DisplayMember).
I have used these two ways, but...
string strDispMem;
strDispMem = listBox1.Items[index].ToString();
// the above returns... "System.Data.DataRowView"
or
strDispMem = listBox1.Text;
// The above repeats first selection the user clicks on.
Any ideas???
vipin Paliwal
|
|
|
|
|
listBox1.SelectedText ( from memory ) - it's something like that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i not understand what u say, sorry.
pls give me brif
vipin paliwal
|
|
|
|
|
try out
for(int i=0;i < listBox1.Items.Count ; i++ )
{
if(listBox1.GetSelected(i))
{
strDispMem = listBox1.GetItemText(listBox1.Items[i]);
}
}
-- modified at 7:38 Tuesday 31st October, 2006
rahul
|
|
|
|
|
Hi all
Does anybody know solution for the next problem.
I have one Windows form defined as a template and another one that inherits the template form.
In the template form I define a method for validating events (for TextBox-es).
<br />
public void Validacija(object sender, CancelEventArgs e)<br />
{<br />
}<br />
I put TextBox on inherited form and when I try to asign validating event to a TextBox (in a designer) a get an error message:
"The method 'Validacija' cannot be the method for an event because a class this class derives from already defines the method."
What am I doing wrong
Thank you !!!
|
|
|
|
|
Hasn't this got something to do with the 'override' option ?
You have to specify that the inherited method is overridable.
There are some other parameters as well along the same lines.
Good luck
Mike
|
|
|
|
|
|
CEvent in C++ is used to raise event in application and can be received in another (is that right).
What is the equivalent in C#? and is it doable to raise an event in a C++ application and receive it in C# application, and how this can be done?
Best regards
Simos
|
|
|
|
|
You could use .Net Remoting for inter process communication. Whenever you want to fire an event from process 1, call a method of process 2 by remoting and then in that process 2's method invoke an event. This will be more secure and better approach to trigger an inter process event.
Regards
Khalid
|
|
|
|
|
Hi
I have a dataset having more than 1000 rows, each row having a primary key. Is there any way can I don insertion or modification or deletion as a whole at a time? Do anybody had code for this, pls send the same. Or else give any url or suggestions also great.
Thanks in advance
Raja Raman S
Raja Raman S
Reuters India Pvt.Ltd.
Bangalore
|
|
|
|
|
u can check the datarows rowstate property of each row of table in dataset
and based on rowstate which could be added,deleted or modified u can
write appropriate queary and update the changes in database through command
object.
rahul
|
|
|
|
|
hi
the Report Service that I use is Report Service2003.
now,I want to make a report that the report's filds are choosed
on the webpage,so the report's filds are activity.
what can I do ? please help me
a question about Report Service
|
|
|
|
|
Your question is vague, but I still try to answer to what I understood from it.
If you are using a report viewer cntrol for MS SQL Reporting and you do not want to use the filter fields (parameters) that the control displays for you on the screen rather you want to have your own input controls acting as filter fields on your page, then you would have to do it a little programatically by following 2 ways.
If you are using Report server then you can append all the parameters at the end of the report path property seperating every parameter with "&" of the ReportViewer control. If you are using stand alone reports then you would have to add ReportParameters to your control by using its method LocalReport.SetParameters(parameterlist).
Hope I have asnwered to what you asked for.
Regards
Khalid
|
|
|
|
|
I am myicewater
I make a example, the web page's name WEBA,there are 20 filds on the page ,
the 20 filds corresponding a datebase table A's 20 filds.
if I choose 5 filds on the page, the report will show the 5 filds infomation
Because the filds I choose are random. so how can I control the reports.
Now I let the report show 20 filds infomation,and pass 20 parameters to report to control which filds showing and which filds hidden.
except this way,can you tell me another way.this is only a simple example,
the realiy is more complexer than it.Now first,I settle the simple one.
|
|
|
|
|
I want to transfer base's data one server computer to another server by using modem. But I don't know how?
|
|
|
|
|
Do you intend to transfer data through internet?
Regards
Khalid
|
|
|
|
|
NO only modem. It's the building who has got 3 server computer and they transfer data by using flash disk. So I want to discuss it by application on C#.
|
|
|
|
|
You need a program uses "serial port" of the computer. I think yoru modem connected to PC trough serial port, if then you need to control serail port of the computer. After achiving control of the serial port, you need to read the "AT Commands" of the modem from its datasheet. Using these "AT commands" you can connect any modem and transfer any data you want. If you have no experience about these procedures, you have to spend time;)
I gave the big picture, may be it will give a general opinion about the think you want.
|
|
|
|
|
i want to bring matlab fuctions and want to use them in c#
functions like imhist,imcrop etc
|
|
|
|
|
Looks like you have the same homework assignment as the fellow below.
|
|
|
|