|
Why don't you tell us what error you get? Do you simply tell a doctor that you have a pain without saying where? How do you expect us to help you if you don't even say what exactly is wrong? There could be many reasons you're having problems. An exception type and message would definitely help.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I noticed in an app sample that it uses an CustomersDataset.xsd file to create its datasets from it. Now in this xsd file is like a customers table with elements in it and also another table with the name of the xsd file as it's title with a ref=customers. This table is linked to another customers table. So there is two of the same customers tables in this xsd but only one is linked to the table with the ref. What is happening inside this xsd file. I noticed in code also that a procedures signature is defined as "CustomersDataset GetCustData()". That's it no public or private in front. How come this isn't throwing an error?
Thanks,
JJ
|
|
|
|
|
MrJJKoolJ wrote:
What is happening inside this xsd file.
You will have to read up on how XML Schema works (have some headache pills handy).
MrJJKoolJ wrote:
That's it no public or private in front. How come this isn't throwing an error?
WHy should it be throwing an error? type members by default are private , while namespace members are internal by default.
|
|
|
|
|
Hi,
I have a problem with creating a diffgram dataset. My connection to database is limited so when I'm not connected to database I need to create a diffgram dataset. But if I'm disconnected how can I get the scheme source for the dataset? I guess I need this in order to create a diffgram dataset. How should I approach this issue?
Thanks,
JJ
|
|
|
|
|
Create a typed DataSet . You can do this programmatically, but it's better and easier to use either the xsd.exe tool that ships with the .NET Framework SDK, or Visual Studio .NET. Right-click on your project or project folder and select Add New-<Add New Item. Select a "DataSet" from the list of choices and give it a name. Create your tables, fields, keys, and relationships. If you have a database connection in your Server Explorer, you can even drag and drop tables and views from it into the design surface for the DataSet . This is documented in the Visual Studio .NET Product documentation, but it's not hard to figure out. Just experiment.
Once you have a typed DataSet , you have the schema. The schema is what created the typed DataSet . This also gives you typed access to tables and columns, which is must faster than using indexes or names (names of columns and tables can be very slow for look-ups). Because the classes derive from DataSet , DataTable , etc., they have all the same functionality as their parent class but imply a schema.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ok this is a Mobile app that doesn't have typed datasets. I was thinking of creating a typed dataset in a dumby Win project and move the xsd file that I create into the mobile app directory and add to project that way. Then I could just call the xsd file for the schema of the diffgram dataset. How does this sound to you?
Thanks,
JJ
|
|
|
|
|
So create a typed DataSet . It's just a class - nothing special. If the .NET CF designers don't support creating one, then make one in a Windows Forms application (like you mentioned) and literally move the source file to the mobile app. It should still compile since, IIRC, all the classes and members used to create a typed DataSet are supported by the .NET CF. If a particular member isn't supported, remove it or re-code the functionality. It's not magic - just a generated source file that extends certain classes in the System.Data namespace. After that, you can forget the XSD file.
Another approach is to create an XSD file and load it into a new, instantiate DataSet using the ReadXmlSchema method. The former approach will result in faster look-ups, however, since even a "simple" column lookup for a particular row goes through several steps to get the corresponding DataColumn . If you use a typed DataSet and instead refer to that DataColumn derivative, you forego all those extra look-up steps.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
Does anybody know the method of drawing 3D piechart? I mean only the 3D depth part.
Example[^]
I already have a piechart drawn, and tried to draw the 3D depth by drawing the dumplicated piechart along the Y axis with darker color serval times underneath the top piechart. but the result is not right. see my piechart here[^]
I also took a look at the code from http://www.codeproject.com/aspnet/webchart.asp[^] without success.
I hope I can solve this problem soon, and post this project to CP.
Thank!!!
|
|
|
|
|
// I'm using Visual Studio C# and the 'EmailMessage' class. Here you see me attempting to retrieve data
// from: newDataSet1 (dataset), Settings (table), SmtpServer (data column) and convert ToString (strSmtpServer)!
// However what I have below retreives the DataColumn name and NOT the actual data (ie... smtp.yahoo.com).
// I feel I'm so close is scarry...
//Create the SMTP object using the constructor to specify the mail server
string strSmtpServer = (newDataSet1.Settings.SmtpServerColumn.ToString());
SMTP smtpObj = new SMTP (strSmtpServer);
//Send the message
smtpObj.Send(msgObj);
// Have mercy on this newbie and help...
|
|
|
|
|
You need to refer to the row data - not the column:
string smtpServer =
newDataSet1.Settings.Rows[0][newDataSet1.Settings.SmtpServerColumn]; This gets the value in the first row under the SmtpServerColumn (you can also use the name or 0-based index, although using the DataColumn instance will be faster).
I suggest you read the documentation for the DataSet class and related documentation. If you're not familiar with this stuff, simply guessing won't teach you anything. Reading the documentation will help, and may be present you with some alternatives in order to do things more efficiently and with less development time.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
With making an arrays of Structures in C# .net, I have these questions:
How do I create?
How do I declare
How do I instansitate
How do I use it?
I have learned in C++ 6.0 how to such a thing and where should I place the array of structure?
Help ASAP and I have found this article named "Quick C#" on this site.
Sincerley,
ProgrammerA
Email me Please!!!
No foul language
Programming, Hardware, Software, Information System security, and OSs.
|
|
|
|
|
Well, you don't have to instantiate a struct, correct? So you should be able to just get away with this:
MyStruct[] structs = new MyStruct[100];
Remember that structs are value structures, so to change values on structs in your array, access the array by index each time unless you pass one by index into a method using the ref keyword. It'd be simplest to just access values the same way:
<br />
int i = structs[10].Data;<br />
-Jeff
here, bloggy bloggy
|
|
|
|
|
|
Search for Double Buffering innn this site to see some example of reducing flickering.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
Besides double-buffering, another problem could be that you're waiting to extract the bitmap from the assembly as an embedded resources until the event fires. This will take some time.
Either pre-extract and buffer the image before the event is fired (like buffering the next and previous images if you're not sure which will be next to display), or don't dispose of the image in the PictureBox until the other bitmap is ready.
Double-buffering will help the situation where you replace the bitmap in the PictureBox , however. Instead of disposing the current image and reading the next image in (so there's some "dead time" in between), the new image is drawn to an off-screen, compatible bitmap and displayed only once it has been rendered to this compatible bitmap. It can then be swapped with the on-screen bitmap fast enough that you shouldn't notice (large images may still flicker a little, however). .NET makes this pretty easy by setting the AllPaintingInWmPaint , DoubleBuffer , and UserPaint ControlStyles enum members using the protected SetStyle method (which requires that you'd extend the PictureBox control.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm having problems sending an object to a web service. Instead of passing it directly to a web method, the proxy generates an alternative class that I must use.
To avoid that, can I xml serialize the object and send it directly to the web service?
If it's possible, can you briefly explain how to do that or where can I get the info?
Regards,
Diego F.
|
|
|
|
|
What do you want exactly do? You can edit your messages to web service , see the documrntation for SoapExtension class in MSDN and googling for examples.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
What I want is working in the client with my custom class instead of working with the class that the proxy generates. Then, I want to pass directly the custom objects to the web service.
To get that, I must first use a fully XML serializable class, so I must have a wrapping class that uses my custom object as a public attribute.
The question is how to implement the wrapper as simple as possible. I saw an example but with too clases: the main class, an implementation of CollectionBase for the main class, a third class that uses the collection as a parameter, and the fourth that gives functionality to the third class.
|
|
|
|
|
I have a project that contains several classes.
Class1 has a public variable, let's say var2, of type Class2.
Class2 has a public variable, x, of type ArrayList.
Finally, in x I load objects of another class, Class3, which has a public property named Myprop.
I cannot access MyProp from Class1.
(like this: var2.x[index].Myprop). Why? What am I doing wrong?
I think I have to announce somehow that in x I load Class3 objects (my x is declared like this: public ArrayList x=new ArrayList())... I don't know.
Please help me!
Thanks
Cristina
|
|
|
|
|
You have to cast the object returned from your Class2 accessor:
((Class3)var2.x[index]).Myprop
To be safe, however, you can't be sure that x at the specified index will have an object instance:
Class3 c = (Class3)var2.x[index];
if (c != null)
{
}
else
{
}
Alternately, you can use the as keyword:
Class3 c = var2.x[index] as Class3;
Ian Mariano - Bliki | Blog
"We are all wave equations in the information matrix of the universe" - me
|
|
|
|
|
ian mariano wrote:
Alternately, you can use the as keyword
As I know, it's not an alternative, the following line would throw an exception if var2.x[index] is not of type Class3 :
Class3 c = (Class3)var2.x[index];
but this will not:
Class3 c = var2.x[index] as Class3;
Don't forget, that's Persian Gulf not Arabian gulf!
Murphy: Click Here![^] I'm thirsty like sun, more landless than wind...
|
|
|
|
|
The latter is still an alternative which is safer than a straight cast, since it won't throw an exception, it will evaluate to null if it can't be cast.
Either usage depends on the intent. I use the former method when ensured of a type (but I still do checks like using Type.IsAssignableFrom ) .. as is just shorter
Ian Mariano - Bliki | Blog
"We are all wave equations in the information matrix of the universe" - me
|
|
|
|
|
Things are stored in ArrayList class in Object variables. So you need to cast them to your desired class when required:
((Class3)var2.x[index]).Myprop
I hope this helps!
abcdabcdabcdabcda
Don't forget, that's Persian Gulf not Arabian gulf!
Murphy: Click Here![^] I'm thirsty like sun, more landless than wind...
|
|
|
|
|
Cristina,
Is there a good reason to use public variables/fields? Are these private internal classes of another class?
-Jeff
here, bloggy bloggy
|
|
|
|
|