|
I have an array declared like this:
byte[,] grayPixels = new byte[rows, cols];
later in the code, (where I don't have access to rows or cols ), I have to iterate through grayPixels , I am using the following code to find the number of rows
int nRows = grayPixels.Length;
How can I find out the number of columns in the above array? Thanks in advance...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
Use grayPixels.GetLength(0) to get the size of the first dimension, and grayPixels.GetLength(1) to get the size of the second dimension.
---
b { font-weight: normal; }
|
|
|
|
|
Hello
int nRows = grayPixels.GetLength(0);
int nCols = grayPixels.GetLength(1);
Andrew
|
|
|
|
|
Thank you very much...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
Problems:
(1) How to get dynamic “Crystal Report” data I mean I have 3 tables named as Job, JobDesc and Emp_Info’ there is a primary key name JobNo now I want that I pass sqldb command at run time and in where clause I pass the JobNo so then on the crystal report only data show which have given JobNo.
(2) How to set Multi-line Report in Crystal Report Detail Section. Like this:
(3) How to display custom date format (Sep-06-2005) in Crystal Report.
Job No Title Employee Id
_____________________________________________________
1 Dummy Dummy Title Dummy Title 001
2 Dummy Title Dummy Title Dummy 002
sdfshdkfsdhkfshdkhs
3 Dummy Title Dummy Title Title 003
_______________________________________________________
I mean which property I have to change in order to get this kind of look.
Sample code can be fine at:
http://sktech.freewebspace.com/My%20Problems/[^]
Yours sincerely,
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
-- modified at 4:30 Monday 5th September, 2005
|
|
|
|
|
I have a Multi Line Textbox. User will input address information.I wantta set cursor to new line, when user press enter key. I try following code to achive but it always set cursor to first line. what do u offer me :S
protected sub txtAddress_KeyUp(........) handles txtaddress.keyup
if (e.key= keys.enter){
txtaddress.text &= envoirenment.newline;
}
end sub
|
|
|
|
|
Hi Greeky,
Well the easy way is to set the AcceptsReturn property of the textbox to true. That should let them press enter onto new lines.
If you want to do it manually, just change the code to the following (converted to c# from interesting vb hybrid)
<br />
protected void txtAddress_KeyUp(........) {<br />
if(e.key == keys.enter)<br />
{<br />
txtaddress.Text += environment.newline;<br />
txtaddress.SelectionStart = txtaddress.Text.Length-1;<br />
txtaddress.SelectionLength = 0;<br />
}<br />
}<br />
<br />
The two lines to note are setting SelectionStart and SelectionLength. This just says move the cursor to the last character, and make sure no text is selected.
Hope this helps
Philip
|
|
|
|
|
uehueh Thank you AcceptReturns is Ok.
sometimes im stupid, why havent i checked all properties before ?
Thank you again
|
|
|
|
|
|
I've found that running
del %temp%\*.*
periodically helps vs.net performance out alot.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
very true, but it didn't help...
|
|
|
|
|
Friends,
How can i successfully compile a low level code in C#.
Thanks in advance.
Sheel Gohe
|
|
|
|
|
If I write a DLL assembly in C# using .NET, can I use it in my VC++ / MFC projects? My question is can such C# DLL be used in C++ type projects WITHOUT first converting the DLL in a COM ?
Thanks
|
|
|
|
|
Just set your C# project to Register For COM Interop in Project Properties.
|
|
|
|
|
is there any way within the .net framework to determine if a string contains a numeric value?
|
|
|
|
|
The easiest way is to put a try...catch around the conversion:
try {
num = int.Parse(str);
ok = true;
} catch {
ok = false;
}
Exceptions are quite expensive, though, so it's more efficient to validate the string before you convert it. You can use the Regex class to check if the string only contains digits, for an example.
---
b { font-weight: normal; }
|
|
|
|
|
do you mean if the string is a number, or can contain a number somewhere amongst a lot of other characters?
For the first, if you want to figure out if a string is a number, I'd use Double.TryParse(string) to figure this out (returns a boolean). (Much more effective then "try-catch"ing)
For the latter, I'd use regular expression to match any digits (\d) and then it'll return boolean. (regular expression can also subtract the numbers it finds, if needs be...)
I hope this help.
---------------------------
127.0.0.1 - Sweet 127.0.0.1
-- modified at 3:18 Monday 5th September, 2005
|
|
|
|
|
|
i have windows service program,and i want to make a config file for it.
if the config file is placed in the directory:system32/,i can access it by System.Environment.SystemDirectory,but when placed in the windows service executable files' directory(bin\debug\),i don't know how to access it.
|
|
|
|
|
You don't need to access the file directly.
Use the classes in the system.configuration namespace to access the configuration file.
If you just have simple string data to access then you can use the AppSettings class and section.
Otherwise you can write your own section handler.
The file should be named yourexe.exe.config, but vs.net will copy any file named app.config from the root of your project to the output directory and rename it to the proper name so your service will read it.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
|
Anyone knows how to disable the tab key function in window form (which move the focus to the next control in the form)? I want my rich text box processes the tab key press like any other key.
Thanks for the answers
|
|
|
|
|
See the AcceptsRab property[^].
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Just Set RichTextBos's "AcceptsTab" property to "True".
Happy Coding.
Sheel Gohe
|
|
|
|
|
haha, code a lot and forget so simple thing
|
|
|
|