|
You can perform logical operators to the number you have. For example:
int Wav16bit = 10;
if ((Wav16bit & SF_FORMAT_WAV) != 0)
{
}
if ((Wav16bit & SF_FORMAT_PCM_16) != 0)
{
}
NOTE: There is only one ampersand.
What it does is look at the bits in the number and perform a logical and operation. So only where positions where the bits match will it be true
0001 & 0001 = 0001 // Both numbers match
0010 & 0001 = 0000 // Not matching bits
0100 & 0101 = 0100 // Only the second bit matches
There is another useful, similar, operator - the logical or operator and it is represented by a vertical bar | It says that if any bits are on on either side then that bit will be on in the result:
0001 | 0001 = 0001
0010 | 0001 = 0011
0100 | 0011 = 0111
Does this help?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
-- modified at 5:03 Wednesday 21st December, 2005
|
|
|
|
|
In your last example you talked about | and used &
|
|
|
|
|
All fixed up now, thanks.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
I think i got it now. I did not put this in my post, but i learned there are "mask" constants used to filter out values.
SF_FORMAT_TYPEMASK = 0x0FFF0000,
SF_FORMAT_SUBMASK = 0x0000FFFF,
By &-ing these with the format number i can get the main format type (WAV, AIFF, AU, etc) or the format subtype (16-bit, 24-bit, etc). From my experimenting |-ing seems to do the opposite of &-ing. It is kind of like adding and subtracting. I am sure as i code more on a low level i will get a better understanding.
|
|
|
|
|
I need this kind of classes:
struct_db mystruct = new struct_db();
public struct str1{
public string nome;
public string lunghezza;
public string tipo;
}
public class tab{
public string nometab;
public str1[] fields;
public string[] index;
public string[] procedure;
}
public class struct_db{
public int count;
public tab[] tabs;
public struct_db(){
tabs = new tab[100];
}
}
if set a value at struct_db.tabs[i].index i have an error because this array is not initialized... how i can initialize the class tab before using?
Thanx
|
|
|
|
|
peppepinna wrote: tabs = new tab[100];
This just reseves the space for the array - but does not initialise it. You need to do something like this on each element:
tabs[i] = new tab();
Does this help?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
Yes i have to initialize for each elements of tabs[i] the struct tab that is not initialised, ad if i give a value at the elements of tab i have an error because this value is a "null reference", with the struct_db = new ... i reserve space for struct db and reserve the space for tabs, but i cannot reserve the space for the elements of tabs. I have try to put "tabs[i] = new tab()" into initialization of struct_db but it doesen't work.
Thanx
|
|
|
|
|
Many thanx you have give me an idea, i have solved my problem, i do a new tab() for each element into the struct_db(){...} and into my tab classes i initialize my arrays.
Many many thanx bye.
|
|
|
|
|
Excellent - glad you got it working.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
Sorry, I missed what you were getting at.
tab.index = new string[length];
for(int i=0; i<length; i++)
{
tab.index[i] = "";
}
Your class does not have a constructor (so C# will create a default one for you) perhaps you should consider creating one in order to initialise the fields properly.
Also, you may want to consider making your fields private or protected and exposing them through properties. See this article[^] for some good reasons to use properties.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
-- modified at 5:12 Wednesday 21st December, 2005
|
|
|
|
|
I have solved in this way:
struct_db mystruct = new struct_db();
public struct str1{
public string nome;
public string lunghezza;
public string tipo;
}
public class tab{
public string nometab;
public str1[] fields;
public string[] index;
public string[] procedure;
public tab(){
fields = new str1[100];
index = new string[100];
procedure = new string[100];
}
}
public class struct_db{
public int count;
public tab[] tabs;
public struct_db(){
tabs = new tab[100];
for (int i = 0;i < 100;i++)
tabs[i] = new tab();
}
now work properly...
|
|
|
|
|
Hi,
I'm quite new to C# and I have been fiddling around with a little problem for some time now.
I have a form with a PrintPreviewControl on it. I also have a RichTextBox on the same form. Now, I want to update the PrintPreviewControl contents whenever I type something in the RichTextBox. As far as I can see, the PrintPreview is only updated when it is created (it seems the creation of the PrintPreviewControl fires the PrintPage event with the previewers graphics context). My question is, how can I update the PrintPreviewControl on demand?
Thank!
Regards,
Lars
|
|
|
|
|
Hi frend!
1 begginer saying to another:
this.TextBox1.TextChanged
then put ur PrintPreviewControl code inside this:
TextBox1_TextChanged
just a though...then again I could be wrong
Aim small, miss small...
|
|
|
|
|
tatchung,
My problem is not how to handle events, but how to access the PrintPreviewControls graphics context on demand. The graphics context is part of the PrintPageEventArgs which is automatically passed to the PrintPage event handler upon creation of the PrintPreviewControl.
Regards,
Lars
|
|
|
|
|
Hi,
i have to create a graphics application in c3 which should draw lines when an user-defined event is triggered...
Plz help me in creating this application in codes.........
Thanx
|
|
|
|
|
You can use the Graphics.DrawLine function.The function takes System.Drawing.pen object to determine color and width and the coordinates as parmaters.
Hope this help.
|
|
|
|
|
thanx bassam...
I have found it right....
|
|
|
|
|
Dear All,
I am calling AcceptChanges in DataTable after adding some rows to the datatable, but that is not affecting the row status.
Please let me know what are the conditions, when the Acceptchange will not take affect.
thanks in advance
Contact him at: hasansheik@hotmail.com
hasansheik@yahoo.co.in
hasansheik@lycos.com
Contact him at: hasansheik@hotmail.com
hasansheik@yahoo.co.in
hasansheik@lycos.com
|
|
|
|
|
Hi Guys I'm still new in development,I need a C# code to scan a document & to save it to the DB pls help..
|
|
|
|
|
Dear All,
I am calling AcceptChanges in DataTable after adding some rows to the datatable, but that is not affecting the row status.
Please let me know what are the conditions, when the Acceptchange will not take affect.
thanks in advance
Contact him at: hasansheik@hotmail.com
hasansheik@yahoo.co.in
hasansheik@lycos.com
|
|
|
|
|
If you use binding you have to call EndCurrentEdit method
BindingManagerBase bmText = this.BindingContext[textBox1];
bmText.EndCurrentEdit();
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
Hello !
I am developing a Windows base application in Visual Studio 2003 by using C# as a language i am using Datagrid Control I have two problems one in Datagrid and one in application can anyone resolve it????
(1). I want when a user clicks any column of datagrid a whole row of selected column must be selected how is it possible ??
(2). When I run application it also shows Taskbar of the System i don't want to show this taskbar I want to show application in full screen of Monitor without any Taskbar
U can also email me the solution at my email address abubakar.malik@gmail.com
Regards,
Abubakar
|
|
|
|
|
I need to develop a system that can transfer data from 1 pc to another pc using dialup because the user dont want use any FTP service.. so i cannot use any isp services
so i think i need to create a service at one side that can accept called from another side and get the transaction and stop the connection...
and i need to create i utlity that can dialup and get data and disconnect..
2 utility 1 dialup and 1 accept call..
how do transfer this to my coding any example or source that i can use.. in c#...
or is there any otherway for me to settle this issue.
thanks
|
|
|
|
|
I have a case which i run the sql statement from my c# application..
becasue the query is big and dont have indexed on the table sometimes i got the timeout error
how so i set the timeout period..
i cannot change the database structure cause is it in use and they dont do want to make any changes to it..
any sugesstion..
|
|
|
|
|
Try this.
Set the 'CommandTimeOut' of the Connection and the SQLCommand object you r using to execute the sql to 0 (Zero)
Rohitha M.Hewa
Senior IT Executive
Naturub Group of Companies - Sri Lanka
|
|
|
|