|
I want to draw arc in a deviceApplication project (Pocket pc 2003) but there is no DrawArc method!!! any ideas.
|
|
|
|
|
If the file is in local drive then it works fine but if it is an URL path then it throws an exception.
example: string _SourceFilePath = "c:\\TMPSTORE\\tmp030104.xls";
it is working fine, but if the file is from http:// url
example: string _SourceFilePath = //http://TMPQADMOMAP101:8090//0000329/0000082/9999/0000016_0000000_tmp030104_V0004.xls;
string XlsFileName=_SourceFilePath;
string strConn;
strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source="+XlsFileName+";" +
"Extended Properties=Excel 8.0;";
System.Data.DataTable dt = null;
OleDbConnection objConn = null;
objConn = new OleDbConnection(strConn);
objConn.Open();
-- modified at 17:23 Thursday 22nd February, 2007
|
|
|
|
|
It throws an exception because
isn't a valid path.
Whatever you used to build this path put a couple of "/" marks at the beginning of the path, and invalidated it in the process.
On top of this, you probably can't use an HTTP path as a data source because you more than likely don't have Write access to the file over HTTP.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hello i m beginer in c# i dont kown how to create a project in c# plz give me some idea . help me plz ...... thank u .......
|
|
|
|
|
just go to the File -> New Project -> at the left choose the C# -> and at the right click on the WinForm or Web whatever you wand.
good luck!
aukh
|
|
|
|
|
Is there a class in the framework that will convert "Idaho" to "ID" or "TX" to "Texas"??? I'm looking for some easy way to do this so I don't have to code it...
|
|
|
|
|
code-frog wrote: so I don't have to code it
What code? It is a data table that is freely available in several places on the net.
led mike
|
|
|
|
|
And if I don't want to invoke any Data Access? Or am I misunderstanding you? Either way my Google wasn't really helpful. Buy my Google Fu isn't that great either.
|
|
|
|
|
|
Ok, admittedly I got carried away implementing this. The source is from the link led mike provided. Specifically, I used this[^] one.
using System;
using System.Collections.Generic;
namespace States
{
public class StateAbbreviations
{
private static readonly Dictionary<string, string> stateAbbreviations = new Dictionary<string, string>();
private static readonly Dictionary<string, string> stateNames = new Dictionary<string, string>();
static StateAbbreviations()
{
stateAbbreviations.Add("ALABAMA", "AL");
stateAbbreviations.Add("ALASKA", "AK");
stateAbbreviations.Add("AMERICAN SAMOA", "AS");
stateAbbreviations.Add("ARIZONA", "AZ");
stateAbbreviations.Add("ARKANSAS", "AR");
stateAbbreviations.Add("CALIFORNIA", "CA");
stateAbbreviations.Add("COLORADO", "CO");
stateAbbreviations.Add("CONNECTICUT", "CT");
stateAbbreviations.Add("DELAWARE", "DE");
stateAbbreviations.Add("DISTRICT OF COLUMBIA", "DC");
stateAbbreviations.Add("FEDERATED STATES OF MICRONESIA", "FM");
stateAbbreviations.Add("FLORIDA", "FL");
stateAbbreviations.Add("GEORGIA", "GA");
stateAbbreviations.Add("GUAM", "GU");
stateAbbreviations.Add("HAWAII", "HI");
stateAbbreviations.Add("IDAHO", "ID");
stateAbbreviations.Add("ILLINOIS", "IL");
stateAbbreviations.Add("INDIANA", "IN");
stateAbbreviations.Add("IOWA", "IA");
stateAbbreviations.Add("KANSAS", "KS");
stateAbbreviations.Add("KENTUCKY", "KY");
stateAbbreviations.Add("LOUISIANA", "LA");
stateAbbreviations.Add("MAINE", "ME");
stateAbbreviations.Add("MARSHALL ISLANDS", "MH");
stateAbbreviations.Add("MARYLAND", "MD");
stateAbbreviations.Add("MASSACHUSETTS", "MA");
stateAbbreviations.Add("MICHIGAN", "MI");
stateAbbreviations.Add("MINNESOTA", "MN");
stateAbbreviations.Add("MISSISSIPPI", "MS");
stateAbbreviations.Add("MISSOURI", "MO");
stateAbbreviations.Add("MONTANA", "MT");
stateAbbreviations.Add("NEBRASKA", "NE");
stateAbbreviations.Add("NEVADA", "NV");
stateAbbreviations.Add("NEW HAMPSHIRE", "NH");
stateAbbreviations.Add("NEW JERSEY", "NJ");
stateAbbreviations.Add("NEW MEXICO", "NM");
stateAbbreviations.Add("NEW YORK", "NY");
stateAbbreviations.Add("NORTH CAROLINA", "NC");
stateAbbreviations.Add("NORTH DAKOTA", "ND");
stateAbbreviations.Add("NORTHERN MARIANA ISLANDS", "MP");
stateAbbreviations.Add("OHIO", "OH");
stateAbbreviations.Add("OKLAHOMA", "OK");
stateAbbreviations.Add("OREGON", "OR");
stateAbbreviations.Add("PALAU", "PW");
stateAbbreviations.Add("PENNSYLVANIA", "PA");
stateAbbreviations.Add("PUERTO RICO", "PR");
stateAbbreviations.Add("RHODE ISLAND", "RI");
stateAbbreviations.Add("SOUTH CAROLINA", "SC");
stateAbbreviations.Add("SOUTH DAKOTA", "SD");
stateAbbreviations.Add("TENNESSEE", "TN");
stateAbbreviations.Add("TEXAS", "TX");
stateAbbreviations.Add("UTAH", "UT");
stateAbbreviations.Add("VERMONT", "VT");
stateAbbreviations.Add("VIRGIN ISLANDS", "VI");
stateAbbreviations.Add("VIRGINIA", "VA");
stateAbbreviations.Add("WASHINGTON", "WA");
stateAbbreviations.Add("WEST VIRGINIA", "WV");
stateAbbreviations.Add("WISCONSIN", "WI");
stateAbbreviations.Add("WYOMING", "WY");
foreach(KeyValuePair<string, string> pair in stateAbbreviations)
{
stateNames.Add(pair.Value, pair.Key);
}
}
public static string GetStateName(string stateAbbreviation)
{
string name;
if(stateAbbreviation == null)
{
throw new ArgumentNullException("State abbreviation cannot be null");
}
else
{
if(!stateNames.TryGetValue(stateAbbreviation.ToUpper(), out name))
{
throw new ArgumentException("Unknown abbreviation");
}
}
return name;
}
public static string GetStateAbbreviation(string stateName)
{
string abbreviation;
if(stateName == null)
{
throw new ArgumentNullException("State name cannot be null");
}
else
{
if(!stateAbbreviations.TryGetValue(stateName.ToUpper(), out abbreviation))
{
throw new ArgumentException("Unknown state");
}
}
return abbreviation;
}
public static IEnumerable<string> Abbreviations
{
get
{
return stateAbbreviations.Values;
}
}
public static IEnumerable<string> Names
{
get
{
return stateNames.Values;
}
}
}
}
Some driver code:
using System;
using System.Collections.Generic;
using System.Text;
namespace States
{
class Program
{
static void Main(string[] args)
{
foreach(string name in StateAbbreviations.Names)
{
Console.WriteLine(StateAbbreviations.GetStateAbbreviation(name));
}
Console.WriteLine();
foreach(string abbreviaton in StateAbbreviations.Abbreviations)
{
Console.WriteLine(StateAbbreviations.GetStateName(abbreviaton));
}
Console.Read();
}
}
}
Written just for fun. Use at your own risk.
|
|
|
|
|
1. Your implementation was/is more elegant than mine. I did it with an ArrayList.
2. Yours is complete. Mine is still being written because the phone keeps ringing.
So because I'm a highly evolved being, short on time and know a good thing when I see it. I'll use yours... at my own risk of course.
Thanks a ton! Now that's probably the most helpful reply I have ever received in my life.
|
|
|
|
|
code-frog wrote: 1. Your implementation was/is more elegant than mine. I did it with an ArrayList.
2. Yours is complete. Mine is still being written because the phone keeps ringing.
So because I'm a highly evolved being, short on time and know a good thing when I see it. I'll use yours... at my own risk of course.
Thanks a ton! Now that's probably the most helpful reply I have ever received in my life.
Hey, glad to be of help. It was my pleasure.
One thing, the < and > symbols got eaten in the post; I forgot to escape them. So if you copy and paste the code, you'll definitely get some compile errors. Should be easy to add them back in, though.
|
|
|
|
|
A suggestion:
Use mixed case in the state names, i.e. "New Jersey" instead of "NEW JERSEY". It's easy to turn the name from mixed case into upper case (or lower case even), but it's a lot more work to turn it into mixed case.
---
single minded; short sighted; long gone;
|
|
|
|
|
Yup! I'm with you and had done that.
|
|
|
|
|
I have an aspx page with controls on it and then a webcontrol on it.
The webcontrol needs to change the value from one of the controls on the parent.
When I just try to refer to the control by its name I get the following error - "The name 'UltraWebTab1' does not exist in the current context"
I'm assuming thats because the UltrawebTab1 is on the aspx page so the ascx doesnt know about the UltrawebTab1.
I know theres a way to do this but I must br using the wrong terms when I google. Whats the mechanism to do that ?
|
|
|
|
|
My first thought is to create a delegate in the web control with a listener on the web page. i.e. raise an event in the control that the page handles.
|
|
|
|
|
Hello
I tried converting a 24bpprgb format image into 8bpp grayscale format… the code compiles well…it even saves the resulting 8bpp image but still the image is not gray scale rather it has some colors in it… would any one pls help… the code that I tried is kind of like this
code:
BitmapData b1 = b.LockBits(new Rectangle(0, 0,b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
Bitmap newB = new Bitmap(b.Width,b.Height,PixelFormat.Format8bppIndexed);
BitmapData b2 = newB.LockBits(new Rectangle(0, 0, newB.Width, newB.Height),ImageLockMode.ReadWrite,PixelFormat.Format8bppIndexed);
int stride = b1.Stride;
int stride2 = b2.Stride;
unsafe
{
byte* ptr = ( byte *) b1.Scan0;;
byte* ptr2 = (byte*) b2.Scan0;;
int offset = stride - b.Width * 3;
int offset2 = Stride2 - newB.Width;
byte blue, red, green;
for (int i = 0; i <b.height; i++)
="" {
="" for="" (int="" j="0;" <="" b.width;="" j++)
="" blue="ptr[0];
" green="ptr[1];
" red="ptr[2];
" ptr2[0]="(byte)" (.299="" *="" +="" .587="" .114="" blue);
=""
="" if="" (ptr2[0]="" ptr3[0]="0;" if(ptr2[0]="">128)
ptr3[0]=1;
ptr+=3;
ptr2++;
}
ptr += offset;
ptr2 += offset2;
}
b.UnlockBits(b1);
newB.UnlockBits(b2);
newB.Save(@"C:\ima1.bmp");
Waiting for reply … thanx
haseeb
|
|
|
|
|
Just because it's 8bpp doesn't mean it's greyscale. 8bpp means you have 255 possibilities of colour. You need to convert it to greyscale manually.
|
|
|
|
|
IF you're saving it as 24/32 bits per pixel you need to set the all 3 of the RGB bytes to the gray value. If you're saving as an 8bit image, IIRC you need to provide a pallet in the file to define the color mapping to be anything except the default colors.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
hello... i get the idea but don't know how to provide a palette and yeah how to do the mappin in palette... would u plz provide snippet...
thanks for the replay and still waiting for one
haseeb
|
|
|
|
|
Use google to find one. The last time I did anything like this was over a decade ago using turbo pascal for dos.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
What on earth is ptr3, a conversion to monochrome ?
The issue is, you are doing the right conversion, but for 8 bit, you need to put those colors into the palette, the value you're inserting into the bitmap is not a colour, but an index into the palette. Change the palette to go from 0,0,0 to 255,255,255, and then this code will work, as the paletter will map directly to the numbers you're passing in.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hello... sorry for the ptr3... my mistake... i pasted the code from ide and forgot to remove the junk code....
thanx for the reply.... i am getting the idea that u are trying to give but still don't know how to manipulate the palette... would u please provide a snippet... I am a bit new to dealing with images in C#...
Thanx
haseeb
|
|
|
|
|
|
Hi,
I have a solution with a web site and a DLL project.
Under my web site I add a reference to an external web service and I get my web reference displayed under App_WebReferences with a .discomap file and a .wsdl file.
I do the same under my DLL project and I get a web reference but there are no files listed, just an icon rather than the files!
If I then go into my web site's code, I can reference the web service just fine. If I go into my DLL project's code, I cannot reference the web service.
What's going on?
|
|
|
|
|