|
Thanks, it turns out that it was padded with spaces, so I just added a
.Trim() and now it works fine.
Patrick
|
|
|
|
|
i need to declare public variable in c# that will available from any form in my project and keep it's value during appliction running like public varaible that we declared in module in vb
ma_refay
|
|
|
|
|
static. isn't a good design tho
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
public class MyFirstForm : Form
{
public int Foo = 5;
}
public class SomeOtherForm : Form
{
public void ChangeFirstFormValue(MyFirstForm instance)
{
instance.Foo = 10;
}
}
|
|
|
|
|
I have a bit map created that is the size of 32x32
When I drag the object I am redrawing it in every paint event. But it is much larger. Appears to be about 48x48.
When I check the hight and width it says 32.
Although the vertical and horizontal resultion is 71.3.
Can anyone tell me how to appear in exact pixels of 32x32?
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
nevermind Grp[hics.DrawBitmap defualts to a format different than Pixel. Its works now when I specify pixel
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
Hello..I'm trying to make my first console app in c#. I've just read a very good book and some articles. So, I'm sure many of my fistr questions may seem very dumb for most of you...please don't be so hard ;o)
Q: I sow that to declare a constant value, it should be declared indide a class. So...what if I want to declare a constant value with scope in my whole app?..should I declare a big class envolving all the code?. Is this a good practice valid even for console and windows apps?
Thanks
|
|
|
|
|
You could do a class like that:
public class Constants
{
static const int MIN_SOMETHING = 5;
}
You can then access them in your whole project like that:
int test = Constants.MIN_SOMETHING;
This is okay for the most important global constants/variables you might need. But don't populate a class just full of static methods to act like an old C program
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
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
|
|
|
|