|
Perhaps an enum is what you're looking for?
public enum Priorities
{
High = 10,
Medium = 5,
Low = 1
}
...
int priority = (int)Priorities.High;
Typically, you don't deal with "globals" per se; everything is contained in a class. Now, if you truely do need a 1 instance class with values in those, you can look into using a static class. But there are only rare occassions for this; whenever I see lots of static classes, especially those that share state between other classes, I immediately think "bad design".
|
|
|
|
|
Oh, thanks a lot friends(both of you). I'm happy to find a place to ask my newbie's and more advenced quiestions.
You're very kind.
-- modified at 17:28 Saturday 12th August, 2006
|
|
|
|
|
Question1
i want to get datagrid cell position when somebody click the particulr cell.usig C#.
Question2
i want to enter combobox in to column in a existing datagrid.usig C#.
hasitha
|
|
|
|
|
Answer1.
add a event, datagrid_cellclick(sender, e).
then you can use e.RowIndex and e.Column ...
Answer2.
if you are using VS2005. you can use DataGridViewComboBoxColumn
(sorry, I didn't have VS2003, if you means in VS2003)
|
|
|
|
|
Could anyone help me how to pass parameter in crystal report using c#.net?
I'm new to this.I need a sample code
Thanks In Advance
REGARDS,
s_mostafa_h
|
|
|
|
|
our solution:
--
create a table in database as crystal report settings.
|
|
|
|
|
In Form1 I've a checkbox . I created a parameter in crystal report .
this is my code :
in btnReport_Click :
{
string strQuery = "SELECT Name FROM MyTable";
sqlconn.Open();
daAdapter = new SqlDataAdapter(strQuery, sqlconn);
SqlCommandBuilder scb = new SqlCommandBuilder(daAdapter);
da.Fill(DatatSet1.MyTable);
ParameterField paramfield = new ParameterField();
ParameterFields paramfields = new ParameterFields();
ParameterDiscreteValue discreteval = new ParameterDiscreteValue();
paramfield.Name = "Name";
discreteval.Value = DataSet1.MyTable.Columns[0];
paramfield.CurrentValues.Add(discreteval);
paramfields.Add(paramfield);
crystalReportViewer1.ParameterFieldInfo = paramfields;
crystalReportViewer1.ReportSource = crystalreport1;
sqlconn.Close();
}
I want to take a report from all of records' Name field of the Table When The user checked "CheckBox1" Control .
I have an Error in this part :
discreteval.Value = DataSet1.MyTable.Columns[0];
with this message :
Value does not fall within the expected range.
Please Help Me !
Regrds ,
s_mostafa_h
|
|
|
|
|
copy this, and paste in VS Help address box:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/crystlmn/html/crtsktutorialsrdparametersdiscrete.htm
this is
Tutorial: Reading and Setting Discrete Parameters
|
|
|
|
|
it didn't help me .
in any case , when the user checked the checkbox contrlol , I want to dislpaly all of the specied field record (for e.g. "Name"), How can i do in this section :
<big>discreteval.Value =???</big>
thanks
s_mostafa_h
|
|
|
|
|
ParameterDiscreteValue.Value Property
Gets or sets the value of the parameter. This can be a string, number, currency, Boolean or date.
--
try discreteval.Value = "special_name";
|
|
|
|
|
this shows only one record of field that we specified . but I Want to show all record this field column .
my field is "Name" in the table .
regards,
s_mostafa_h
|
|
|
|
|
you can build all names in to a string, like this:
name1,name2,name3
then split it in crystal report formula editor?
I am not sure which manner you used in crystal report.
if you can't split it. I have no idea.
may be you need contact crystal report support to solve
your problem?
|
|
|
|
|
hi all how do u do a password autherication application using VS 2003 i have found some articles here but it's in 2005 format and i cant open the source code...
can anyone give me links to related articles in vs03 version ??
thanks
|
|
|
|
|
there no related articles in VS2003 if the article is about Membership.
|
|
|
|
|
To create a simple registration system for my program, I create a fingerprint from the users HD serial number, and create a 'salt' with the user's name, email, and the program name. This is then hashed, and compared with the key that I provide them based on the HD serial they provide me.
What are others doing?
|
|
|
|
|
I think using the HD serial number is quite user-unfriendly. Harddisks tend to fail sooner or later and can easily be exchanged. So if you have to request a new key because the SW you bought doesn't work any longer after a disk failure, I'd be quite pissed.
Binding a software to a single PC can never be done 100% safe and user-friendly, but in my company (we don't create shareware, but that's not the point) we chose to use the computer name (hostname) as the identifying property, since it's the least probable to change.
Of course, if you don't have a network connection you can have more than one PC with the same hostname, but in real life this just doesn't occur.
That way, any part of HW can fail and be exchanged, even if you restore a complete system backup to a completely new machine the hostname is kept unchanged, so this method is working quite well.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi everyone,
I recently converted my vb.net code to c#.net, it was running ok at first with few minor error that needed me to attend to. Then when finally I got all the error fixed and press 'F5' to start debugging or run my application, my application did not pop up, it is running but it seems my .exe did not run.
I don't understand what happened as this is the first time I encounter this, please do let me know why is this happening, without the application running I can't proceed.
Btw, before I post this one error message appear saying some stack overflow.
Thanks
Jie Liang
|
|
|
|
|
Evidently you made some change that is causing a stack overflow before the visible window is rendered. Most likely you changed some code in an event handler in such a way that it is being called recursively, resulting in a stack overflow. Put a breakpoint at the beginning of the routines you modified, then single step until you spot the bug.
|
|
|
|
|
Hi Rob,
Thanks, I found out why. I was calling a function in let say ParentPage call ParentPageFunc in ChildPage by doing this 'ParentPage parent = new ParentPage()' which is why the ParentPage is being created again and again before the ParentPage can be shown. So instead of that I do this 'public ParentPage parent' so that I can do this 'parent.ParentPageFunc' in ChildPage. And the ParentPage pops out as normal.
Jie Liang
|
|
|
|
|
hi
How can i change color of an item of listbox which is selected or set focus?
Thanks for your favor.
|
|
|
|
|
Open the display properties in the control panel. Go to Apperabce, click Advanced. Choose "Selected Items" and change the color.
This will of course change the color of all selected items in the system.
---
b { font-weight: normal; }
|
|
|
|
|
Just like the tittle,
In a Windows Service ,A Process(such as Process pro1 = new Process("aa.exe");) was used to call a windows application,but deny.
Thanks for your help.
|
|
|
|
|
hi there
I want to capture received data from modem.I have been testing it with serialport class in .Net , but it diden`t work completely.
What should i do for it.
Best wishes
|
|
|
|
|
|
Do you want to capture the data through IP or through serial port ?
For IP see the reply from Divyang Mithaiwala.
For serial port, use this : http://www.compt.ru/
|
|
|
|