|
if ((bByte <= byte.Parse("1F", System.Globalization.NumberStyles.HexNumber)) || (bByte >= byte.Parse("7F", System.Globalization.NumberStyles.HexNumber)))
return ".";

|
|
|
|
|
There is no || operator in VB, I guess that you mean or .
if (bByte <= 0x1f || bByte >= 0x7f) return ".";
or why not use decimal numbers:
if (bByte <= 31 || bByte >= 127) return ".";
---
single minded; short sighted; long gone;
|
|
|
|
|
Hey Guys,
I'm new to C#... Have never used Microsoft Visual Studio. It was my first day today to install it and attempt to open a new project, whatever I chose (console application, windows application) as soon as I press ok it displays "The filename, directory name or volume label syntax is incorrecr". I dont understand what that means or whats wrong.
Second I have an assignment to do. I need to compile a library management system and the assignment was due a few hours ago and I really have no idea where to start or what to do. Any help would be appreciated.
Thanks
Diana
|
|
|
|
|
Hi,
It is a your assignment ........and you know what is a purpose of an assignment .........i amaze that you install visual studio "today" and your teacher give "Library management system" assignment.......teacher would not be wrong......it's means you are not new in C#(otherwise teacher does'nt) !!!
Anyway....you should purchse visual Studio C# books......you can download the free ebooks of C# from internet.
please ask the more spesific question related your problem......i am also new in C#,but i never need whole coding of any program....i just want "Hint"........i know ther is thousands of sites where i get the any program's code....but there is not right way........i always struggle to improve the my coding and my logics......
logic or technique is basic things otherwise there are thousand cmmands/syntax etc.. you can't learn that at once.
i advise that you breakup the your problem/assignment into small parts/targets,and then try to achieve these targets step by step.
like ..in 1st step you try that how open the Form in C# ?and how you can close that Form ?in 2nd step you learn that how you can use the Buttons in C#...and so on
THANKS
|
|
|
|
|
Which version of Visual Studio do you have? Do you have Express? Pro? ...For help on something like that, open up Visual Studio and document the EXACT steps that you take to get the error. I prefer to see them as pipe delimited, so post them something like this: (And make up some shorthand notation for some of the repetitive words) (...pretend that the ampersands aren't there.)
&< C &> = Clicked
&< C &> File | New Project | Class Library
Named the class library "foo" | &< C &> OK
Visual Studio barfed...
Try to describe exactly what it is that is causing your problem and maybe someone could help you.
Welcome my son...Welcome..to the Machine
|
|
|
|
|
Hi everyone, I've been writing a class that I want to be able to enumerate over different types in a foreach statement. I've tried googling with no luck, and I was hoping that someone here could help me out.
|
|
|
|
|
You can write enumerators for different types, within the class, so that the class is able to be enumerated over using different types, via different properties. Is that what you want ?
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
I think so. Do you know of an example anywhere that you could point me to?
Right now, I have something like:
<code>
IndexType IEnumerator<IndexType>.Current{...}
KeyValuePair<IndexType, T> IEnumerator<KeyValuePair<IndexType, T>>.Current{...}
</code>
and I am getting the error
<code>Error 1 foreach statement cannot operate on variables of type 'Myclass<int,int>' because it implements multiple instantiations of 'System.Collections.Generic.IEnumerable<T>', try casting to a specific interface instantiation 232</code>
The foreach statement is
<code>foreach (int i in info)</code>
where info is of type Myclass<int,int>
|
|
|
|
|
I'd expect you need a property that returns the enumerator, so you use the property to select which enumerator to use.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
First off, thank you very much for the help so far. I am a little unclear on what exactly you mean here. Could you please be more specific what property I need to implement to make this work with a foreach statement? I've been looking and can't seem to find any documentation on it. Everything I've seen seems to assume that you only want to iterate for one data type. Is what I'm trying to do even possible?
|
|
|
|
|
I thought you could create properties which return an IEnumerable<T>, and then those would allow a single class to specify several types which could be iterated over.
So you end up with
foreach(int n in myClass.Ints)
and
foreach(string s in myClass.Strings)
you can't have more than one type for
foreach(string s in myClass)
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Ok, I see what you're saying now. Thank you very much for your help.
|
|
|
|
|
Hi,
with the given error message I assume you have a class like this:
class SampleClass : IEnumerable<int>, IEnumerable<string> { ... }
If you want to iterate over the ints then do:
SampleClass mySampleInstance;
foreach (int i in (IEnumerable<int> )mySampleInstance) { ... }
or if you want to iterate over the strings:
foreach (string s in (IEnumerable<string> )mySampleInstance) { ... }
Robert
|
|
|
|
|
Hi, I want to save data in a .dat file, but when I open the created .dat file, I can read the text in it. How can I make the data unreadable? Thanks everyone. -Bruce
|
|
|
|
|
Hi,
you could create a binary file (use BinaryWriter instead of TextWriter), it would be
faster and more compact, but then you could still recognize (most of) the string data.
and you could use cryptography; .NET has some classes for this.
It all depends on how secure you want your data, and how much effort you want to put in it.
|
|
|
|
|
We are making a project using C#,it is an image processing project, we want to calculate the generalized eigenvectors and eigenvalues for two matrices...
In the DotNetMatrix I found the calculation of eigenvectors and eigenvalues but for one matrix only
Can anybody help?
Thanks,
m w
|
|
|
|
|
Hi,
please read the Christian Graus's articels related to the image processing from this forum ........it is a very usefull and helpful for biggner .........i like these articles.....you can also search the other author's articles.
|
|
|
|
|
Hi,
By your help I able to draw the any shape into the pictureBox and able to save the drawing.
It is a simple way to save any image from the pictureBox
pictureBox2.Image.Save(saveFileDialog1.FileName);
but above command do work when any image is already load onto the pictureBox.otherwise some error occur like that:
"NullReferenceExpection was unhandled !"<br />
"Object reference not set to an instance of an object."
“this is because you can't actually draw inside a picturebox. Although it may look like you're doing so, you are in fact drawing 'on top of' the picturebox and the image is not changed. So, if you haven't loaded an image, then the Image property will still be null.”
“If you use a picturebox, put a picture in it, and draw on it first. Then you can save it. CreateGraphics should be used only for drawing things you want to be able to erase, such as rubber bands. It is not for persistent drawing, and certainly it makes your picture box a waste of time, it never does anything”
Solution of above problem is that
“You need to make the graphics drawn on the PictureBox to be a persistent bitmap then only you can save the image.
Use a bitmap to draw the images upon and then reflect it upon your pictureboc. When you want to save just save the bitmap.”
So, I use follwing command to draw any thing
Bitmap bmp = new Bitmap(pictureBox.Width, pictureBox.Height);<br />
Graphics g1 = Graphics.FromImage(bmp);<br />
Graphics g2 = pictureBox.CreateGraphics();<br />
Pen p = new Pen(Color.Red, 5);<br />
g1.DrawEllipse(p, e.X, e.Y, 50, 70);<br />
g2.DrawEllipse(p, e.X, e.Y, 50, 70);
And use follwing command for save the drawing
if (saveFileDialog1.ShowDialog() == DialogResult.OK)<br />
{<br />
<br />
bmp.Save(saveFileDialog1.FileName);<br />
<br />
}
Am I success???
You notice that I use both bitmap and pictureBox at a time
Bitmap bmp = new Bitmap(pictureBox.Width, pictureBox.Height);<br />
Graphics g1 = Graphics.FromImage(bmp);<br />
Graphics g2 = pictureBox.CreateGraphics();<br />
g1.DrawEllipse(p, e.X, e.Y, 50, 70);<br />
g2.DrawEllipse(p, e.X, e.Y, 50, 70);
I used bitmap for save(hard copy) the drawing and pictureBox used for seeing(soft copy) the image from the screen ………Am I right?
Many Thanks
|
|
|
|
|
Why are you both drawing on the image and on the screen? You are still just drawing on the screen where the picture box happens to be, so the graphics will disappear whenever the window updates.
Why not just how the image in the picture box?
---
single minded; short sighted; long gone;
|
|
|
|
|
if i use only Bitmap like as
Graphics g1 = Graphics.FromImage(bmp);
then drawing do not appear on the screen. i used Bitmap for save the drawing...............So i also used
Graphics g2 = pictureBox.CreateGraphics();
if you have other solution then tell me........
thanks
|
|
|
|
|
The reason it's called a picturebox is that it has a property called Image, which you can pass an Image or Bitmap to, and it will draw it to the screen. You really should buy a book on WinForms and read it.
You need to call Invalidate() on the control to get it to redraw itself when you change the Bitmap, but if you set the Bitmap you're drawing to, to be the Image of the control, it will draw it for you.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
zeeShan anSari wrote: if you have other solution then tell me...
I just did.
---
single minded; short sighted; long gone;
|
|
|
|
|
zeeShan anSari wrote: Graphics g2 = pictureBox.CreateGraphics();
Looks like I answered you before. This is a total waste of time. g1 draws to the Bitmap, and the picturebox displays the bitmap. CreateGraphics is both superfluous in this case, and still as useless as the last time you asked about it.
zeeShan anSari wrote: I used bitmap for save(hard copy) the drawing and pictureBox used for seeing(soft copy) the image from the screen ………Am I right?
You're wasting your time drawing to the picture box, what did you think a picture box is ? It's a control that displays a bitmap 'for seeing'.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
hi
i want to know how to read,delete,insert,update database(Ms Access)using c#.if anybody know please reply.
|
|
|
|
|
Hello,
The best way to get the desired result fast is to use ADO.NET connections and commands.
Tutorials can be found here: http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson01.aspx
|
|
|
|