|
Hi there,
The following code generates the CS0122 "System.IO.FileStream.FileStream() is inancessible due to its protection level."
What am I doing wrong?
Thanks,
Akos
>>>>>>>>>>
The code:
using System;
using System.IO;
namespace MyStreamReader
{
///
/// Summary description for MyStreamReader.
///
public class MyStreamReader : System.IO.FileStream
{
public MyStreamReader()
{
//
// TODO: Add constructor logic here
//
}
}
}
|
|
|
|
|
the mistake in your code is that you are trying to use the default contructor of the filestream class. But this constructor isn't accessible. A solution to this problem is just using another constructor of the filestream class. You can call other constructors via the base synonym(as you can see in the following code).
class b : System.IO.FileStream
{
public b(string str): base(str,FileMode.OpenOrCreate)
{
}
}
|
|
|
|
|
Beauty! Thanks Hooray!
Akos
|
|
|
|
|
when i use the method Mesh.clean(...), throw a exception of System.NullReferenceException. this is my code:
private void LoadMesh(string file)
{
ExtendedMaterial[] mtrl;
GraphicsStream adj=null;
// Load our mesh
mesh = Mesh.FromFile(file, MeshFlags.Managed, device, out adj, out mtrl);
// If we have any materials, store them
if ((mtrl != null) && (mtrl.Length > 0))
{
meshMaterials = new Material[mtrl.Length];
meshTextures = new Texture[mtrl.Length];
// Store each material and texture
for (int i = 0; i < mtrl.Length; i++)
{
meshMaterials[i] = mtrl[i].Material3D;
if ((mtrl[i].TextureFilename != null) && (mtrl[i].TextureFilename != string.Empty))
{
// We have a texture, try to load it
meshTextures[i] = TextureLoader.FromFile(device, @"..\..\" + mtrl[i].TextureFilename);
}
}
}
// Clean our main mesh
Mesh tempMesh = Mesh.Clean(CleanType.Simplification ,mesh, adj, adj );
// Replace our existing mesh with this one
mesh.Dispose();
mesh = tempMesh; //when run here, throw a exception
}
i have no idea that what can i do.
|
|
|
|
|
I've been trying to write a quiz program using windows forms. I've been searching around for examples and can't find anything. Everything I read or find is only text related. How can you include an image in a dataset or datatable??
Could someone please write a basic program with 2 multiple choice questions containing some text and an image. Perhaps you could email me the source code or something. Maybe use a xml file or txt file to contain the quiz data.
An example question could be:
What type of fruit is in the picture?
Choice A = Apple
Choice B = Orange
Choice C = Pear
Choice D = Carrot
Any help with this would be really appreciated!
|
|
|
|
|
Do you want to put images into your database, or could you use an array as your data source ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Using an array for the data source which could be used to then load the image from a bmp or jpeg file.
Thanks..
|
|
|
|
|
Then why can't you do what I suggested to you days ago ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Couldn't figure out how or where to add the code as I didn't understand how to use the code with the question code.
|
|
|
|
|
Why didn't you ask ? Will you abandon the next worthwhile solution if you can't get it right away ?
The idea is to keep a list of images, and points where they appear on the screen, in a structure with the text. To 'draw' each question, dump the text and then iterate through the images, drawing them in the right place. This will need tweaking if they area they are drawn on can change in size, to scale image location.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hello i am trying to write some characters to an xml file in strings that arent good in an xml file specificly & i realize you can replace this with &
and i read about the function HtmlEncode on msdn
my question is were do i find this function or is it set someplace in my xmltextwriter object
please help me out
|
|
|
|
|
as far as I know does the xmlwriter nothing like this - because xml supports different encodings it is not neccessary to htmlEncode the string.
But if you wish to use the HtmlEncode function you can use it the following way.
string str = System.Web.HttpUtility.HtmlEncode("bye");
To have access to the System.Web Namespace you need to add a new reference (System.Web.dll) to your project.
|
|
|
|
|
hooray wrote:
because xml supports different encodings it is not neccessary to htmlEncode the string.
Let me correct you, HtmlEncode has nothing to do with "different encodings" ( here I assume you mean UTF, ASCII etc) but problem is that at least characters < > & etc. has special meaning in XML, and they cannot be in XML document in literal form. You have to either wrap 'em into CDATA or "enocde/escape" them as character enties - e.g. &, <... HtmlEncode does exactly this kind of "encoding".
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
yeah - that right.Thanks for the correction.
that was my mistake because I only thought of the language specific umlauts.
|
|
|
|
|
Is it possible to create a custom event/event hander?
Like say, call my EventHanlder when the even of a variable changing.
int i=0;
If the value of i changes, Can I make an event handler for it?
/\ |_ E X E GG
|
|
|
|
|
The only way to do this AFAIK is to turn i into a property, and then firing an event in the setter.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
So, yes! I have to go to google now and find out what AFAIK is, finally....
/\ |_ E X E GG
|
|
|
|
|
as far as I know. Got it.
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote:
I have to go to google now and find out what AFAIK is, finally....
Look at this[^]. I've found this list useful.
still, it's pity one can't add more... e.g "asl" (age, sex, location) is missing there, one from those often used. But then when people feel need to abbrevate word "crazy" into "czy" it seems czy to me.
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Now that I think about it. Why even use an event handler, why not just preform some action in the property setter?
/\ |_ E X E GG
|
|
|
|
|
The only possible reason is that the event needs to be subscribed to by another class. Otherwise, that's what properties are for.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I think I can visualize that. Programming comes sooo un-natural to me.
/\ |_ E X E GG
|
|
|
|
|
How to play mp3 files?
Thanks
|
|
|
|
|
IMO I think that the easiest way to do it is to implement the Windows Media Player Control in your solution. Have a look here[^].
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
I want to launch my application from windows explorer, by right clicking it and selecting a custom made menu item. I can make a reg entry in the HKEY_CLASSES_ROOT key in the registry to do this, but i dont know how to go about sending a list of selected filenames to the program, and how the program should interpret it :S
I need to have 2 items in the menu. One passes folders to the program when user selects a single or multiple folders. The other is for when the user selects files.
In each case a list of selected files/folders needs to be sent to the program.
Some help on this would be appreciated.
|
|
|
|