|
|
The answer is, if u want 4 ints to be constant, then declare all 4 ints seperately as const.
Another option, is to create an enum with all const variables as its members. Thayt would ensure the readonly property of all the variables.
private enum Constants:int
{
WHATEVER = 0x0001,
SOMETHING = 0x0003,
PEPSI = 0x0005
}
|
|
|
|
|
You want to bit mask them - mind you the actual values of your consts then becomes pertinent, but you end up with something like this:
private const int WHATEVER = 0x0001;
private const int SOMETHING = 0x0002;
private const int PEPSI = 0x0004;
then for 'all'
private const int ALL = (WHATEVER | SOMETHING | PEPSI);
That help?
|
|
|
|
|
private const int ALL = (WHATEVER | SOMETHING | PEPSI)
That code is creating a new const ALL=7.
if what ur trying is to create an array:
private const int[] ALL=new int[3] {WHATEVER, SOMETHING, PEPSI}
that wont work either because int is a valuetype and therefore the array will contain the values of the consts, but not the consts themselves.
|
|
|
|
|
I know it's creating a new const. That's exactly what the original message asks for:
> But if I want to add them to one 'const int'!
That's the exact question. I think the array was a red herring, no?...
Kofi
www.activepeermentoring.com
|
|
|
|
|
Yes, of course u are creating a new const, but ur creating a const with its value = WHATEVER + SOMETHING + PEPSI.
I dont think thats what u were looking for, because if it were, then I really dont understand why all the fuzz...it would be as simple as:
private const int ALL = WHATEVER + SOMETHING + PEPSI
Again...if u want consts, then declare consts seperately...there is no way to declare an array of consts....the closest thing to that is creating an enum as i've posted before.
|
|
|
|
|
This is a really odd problem I just discovered with our thin client app.
We have a client/server solution that utilizes .NET remoting. Basically, the client will occassionally ask for data from the server, the server will read data from a database and return it to the client. All that works well:
Blob[] serverObj.GetBigBlobs();
public Blob[] GetBigBlobs()
{
return new Blob[] {...};
}
Pretty simple example. But what I soon discovered is that when the client calls the GetBigBlobs method, the server memory shoots up (expected) but never releases the memory until the client is disconnected (unexpected), even if I force a garbage collection using GC.Collect().
So my question is, why is the server memory not being released right away? The server method creates and returns the huge Blob[], but never uses it again nor references it; so why is the garbage collector hanging onto it? The only thing that pops into my head is that the server does hold a reference to an MarshalByRefObject published by the client, but nothing else -- that shouldn't cause problems right?
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|
|
hi everyone
i need an urget urgent urgent help
well what i need help in is, that i want to develop a call card solution , let me exaplin simply, my customer will buy a card, then dial a number, this number asks him to insert the pin code, the authentication is done, then the system will give him a tone and he will dial is number!
ofcourse using .NET
well thats its!
so is there anyone can lead me to anything to start with, any link or code or tutorial and wwillllll be realllyyyy thankfulllll
Kind Regards
Mahmoud Manasrah
|
|
|
|
|
manasrahfantom wrote:
i need an urget urgent urgent help
So, why is it so urgent?
manasrahfantom wrote:
so is there anyone can lead me to anything to start with
Start where? There are so many areas you could start with. You are not being very specific. (I also notice you posted this in the VB.NET forum also - so you are not even being specific with the language)
I suggest you work out all the different areas that you will need to know about and then, when you have a better idea of what you are having problems with, you can come back and ask specific questions about a certain area of .NET.
Asking for help at this level marks you out as someone who has not got the slightest idea and that you are in way, way over your head.
Do you want to know more?
|
|
|
|
|
First you need to define your hardware platform. Any decent telephone pabx will allow you to implement your requirements.
Secondly. Telephony programming is a pain to do in .NET unless the API supports it.
Michael
CP Blog [^]
|
|
|
|
|
The purpose of the troubled app is to return information about a list of users from Active Directory. It should return user's full name and email address. The number of users does not exceed 1000 people. The results return in less than 1 minute when ran from a regular desktop PC, but when I try running the app on a server it times out. The server is a beast of a machine in all aspects (network, processor, memory) when compared to the desktop pc. So why would it run so much slower on the server?
"...practice safe hex when IM'ing"
--Shawn L. Morrissey, Managing Editor, MSDN Online ( MSDN Flash; Volume 8, Number 20, 10/4/2004)
|
|
|
|
|
I made a simple control with 2 multiline textbox inside.
I droped a few control on a form and I resize them all when
form resize. How could I remove flicking? When it's resizing,
all text inside the control is repainted.
Thank you and sory for my poor english.
|
|
|
|
|
this.SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);
this.SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint, true);
this.UpdateStyles();
|
|
|
|
|
I have the same problem and there doesn't seem to be any kind of solution for this available.
Double Buffering with that SetStyle thingy didn't work.
|
|
|
|
|
I want to install DotNetFramwork befor my application automatically in my setup because as you know the DotNetFramwork must be installed for C# programs
|
|
|
|
|
Do u want to do it by your C# program or what there is no way for that cuz that program won't start the only way for this is the pc that the program will be on it to have the .NET framework installed or In the README file give them instructions to download it and give them the link to the direct download
ByMindOnlyYouCanDoIt
|
|
|
|
|
So Im calling a sproc with various required parameters. It returns a value through one of its parameters, so, I added the following to lines to my command object setup;
oCommand.Parameters.Add(new SqlParameter("@Return_ValueMsg", SqlDbType.VarChar, 255));
oCommand.Parameters["@Return_ValueMsg"].Direction = ParameterDirection.ReturnValue;
But...., I keep getting this exception when I try to execute the command,
{"Procedure 'glpImportJEFromProcurement' expects parameter '@Return_ValueMsg', which was not supplied." }
Any Idea's?
Thanks,
Ryan
|
|
|
|
|
ParameterDirection.ReturnValue is for the integer value returned from the stored procedure via the RETURN statement. Use ParameterDirection.Output instead.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
ahh thanks!, i just have been staring at this too long.
|
|
|
|
|
i made tow combobox one of them filled in page load and the other one fill when the user select a value form the First one but i got this error:
"The Column prefix 'System.Data' does not match with a table name or alias name used in the query"
and this my code:
the First Combobox:
SqlConnection cnn = new SqlConnection();<br />
cnn.ConnectionString = DB.ConnectionSTR(DB.Current_DB());<br />
SqlCommand cmd = cnn.CreateCommand();<br />
cmd.CommandType = CommandType.Text;<br />
cmd.CommandText = "Select Client_ID,Client_Name From Client";<br />
SqlDataAdapter da = new SqlDataAdapter();<br />
<br />
DataTableMapping TblMap;<br />
DataColumnMapping ColMap;<br />
TblMap = da.TableMappings.Add("Client","Client");<br />
ColMap = TblMap.ColumnMappings.Add("Client_ID","Client_ID");<br />
ColMap = TblMap.ColumnMappings.Add("Client_Name","Client_Name");<br />
da.SelectCommand = cmd;<br />
DataSet ds = new DataSet();<br />
da.Fill(ds,"Client");<br />
<br />
cboClient_Name.DataSource = ds;<br />
cboClient_Name.DisplayMember = "Client.Client_Name";<br />
cboClient_Name.ValueMember = "Client.Client_ID";
The Seconde combobox:
<br />
SqlConnection cnn = new SqlConnection();<br />
cnn.ConnectionString = DB.ConnectionSTR(DB.Current_DB());<br />
SqlCommand cmd = cnn.CreateCommand();<br />
cmd.CommandType = CommandType.Text;<br />
cmd.CommandText = "Select MSA_ID,MSA_Effective_Date From MSA Where Client_ID="+cboClient_Name.SelectedValue.ToString()+"";<br />
SqlDataAdapter da = new SqlDataAdapter();<br />
<br />
DataTableMapping TblMap;<br />
DataColumnMapping ColMap;<br />
TblMap = da.TableMappings.Add("MSA","MSA");<br />
ColMap = TblMap.ColumnMappings.Add("MSA_ID","MSA_ID");<br />
ColMap = TblMap.ColumnMappings.Add("MSA_Effective_Date","MSA_Effective_Date");<br />
da.SelectCommand = cmd;<br />
DataSet ds = new DataSet();<br />
da.Fill(ds,"MSA");<br />
<br />
cboClient_Name.DataSource = ds;<br />
cboClient_Name.DisplayMember = "MSA.Client_Name";<br />
cboClient_Name.ValueMember = "MSA.Client_ID";
|
|
|
|
|
You are not including MSA.Client_ID and MSA.Client_Name in ur MSA SQL select command. Those DataColumns dont exist in the MSA DataTable and therefore u cannot databind to them.
|
|
|
|
|
Thanks about your Help
but i change it to :
cmd.CommandText = "Select MSA_ID,Client_ID,MSA_Effective_Date From MSA Where Client_ID="+cboClient_Name.SelectedValue+"";
but it give me the same error
please help
|
|
|
|
|
Ok, I haven't seen your code so I'm not sure if this is your problem, but it does sound like it is:
Whats probably happening is that u are databinding the second combobox in the form's contructor or in any other method that runs before the Load event and thus the second combobox's databinding is active when u start filling the first combobox. The Fill method is triggering ur probable SelectedIndexChanged event on ur first Cbo and thats whats causing the problem. U cant have that event happening while ur first dataset is filling. Your sqltextcommand will not build right because it cant read a loading datatable: thats why ur getting the error "The Column prefix 'System.Data' does not match with a table name or alias name used in the query". It's because SelectedValue is probably giving u the type of the ValueMember ("System.Data.DataViewManagerListItemTypeDescriptor") because it can't read anything else at that point.
Solutions:
Link the SelectedIndexChanged event manually in the LoadForm event handler (not through designer which links it in the constructor) , AFTER ur first cbobox code.
Best soltion: If ur sure that u only want the event to happen when a user commits a change in the first cbobox, then use the SelectionChangeCommitted event. U can link this one from the designer as it will only fire when a user changes the selected index. It wont fire with a code induced change.
Check and seee if this fixes the problem.
P.D. Recheck the code in ur second cbobox, ur databinding the wrong ComboBox....i think.
|
|
|
|
|
Hi Skynyrd ,
Thnaks your soultions working very good ...
i used SelectionChangeCommitted event
may you help me to understand why the selectedvalue dosnt work
regards
ha
|
|
|
|
|
I was wondering
is it possible to use a online database in a local application?
And yes how?
Is it also possible to use a My SQL database in a progam and again yes how?
Could someone help me please
im trying for months now
The_Underdog
|
|
|
|