|
The data types of your DB are set when you create the table, not when you insert data into it. If you read here[^], you'll find how to get the info you need. If you look here[^], you'll find that this works.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
Any one suggest me how to call a static method inside a class. I am having a class named as user in my project. i want to call the user type method which is declared as public static....................
In my aspx page i created an instance and trying to call the method. But it list all the method expect the method with static.
How to call it, please suggest me.
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
You don't need an instance for static methods.
class User
{
public static void Foo() { ... };
}
call:
User.Foo();
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I suggest doing a bit of reading on C#. Or some googling. If you did any reading at all on what a static method is, you'd have found your answer, and it's obvious you don't know, so you should move beyond solving your immediate problem, and understand what static means, and what it's used for, so that you move forward in learning the basics of C# and OOP.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thankyou very much..
ya you are correct i have to learn opps and c#. I will do that,.
Know is Drop, Unknown is Ocean
|
|
|
|
|
Hello, i´m very novice with Visual C#. I want to make a player that can establish marks points of start and end on a video to save a subclip, for example I have a video of 10 minutes, and i want a subclip that go through minute 2 to minute 5, it would be a subclip of 3 minutes, and i want to save this subclip. I maked a player with AudioVideoPlayback with DirectX SDK. Is it possible to make a video player that can establish marks points using DirectShow library without the AudioVidePlayback or i have to use both, or i have to use another differents libraries or anything else?
Sorry about my english, I´m Spanish.
Thanks a lot.
Regards.
|
|
|
|
|
xraziel wrote: i´m very novice with Visual C#.
xraziel wrote: I want to make a player that can establish marks points of start and end on a video to save a subclip
This doesn't really add up. I assume that you're not writing for a paid project and therefore a library like the tvideograbber from datastead is out of the question. That being the case, this task is probably beyond you, there's no built in support AFAIK, and you'd need to write a far amount of DirectX code. Learn C# first.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am getting a double icon when I maximized a child window, I don't want this to happen, it looks terrible. Anyway to prevent this?
Unmaximized
Maximized
This is what happens if I start the child form maximized... THREE close buttons?!
Crazy
Whats going wrong here?
|
|
|
|
|
I think there might be something wrong in way you make the form MDIChild! Can you post back how are you doing this? Other than that I cannot think of any other thing that would cause such problem
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|
|
There is a method on the mdi container form to launch children.
public void ShowMdiChild(Form form)
{
Cursor = Cursors.WaitCursor;
form.MdiParent = this;
form.WindowState = FormWindowState.Normal;
form.Show();
Cursor = Cursors.Arrow;
}
|
|
|
|
|
Try this code:
<br />
<br />
Cursor = Cursors.WaitCursor;<br />
<br />
YourForm frm1 = new YourForm();<br />
frm1.MdiParent = this;<br />
frm1.Show();<br />
frm1.WindowState = FormWindowState.Maximized;<br />
<br />
Cursor = Cursors.Arrow;<br />
<br />
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|
|
System.Web.UI.UserControl (a)
Inherited by BaseSelectClass (b) this is a class inheriting (System.Web.UI.UserControl) and has its ow few methods. So “a” is inherited in “b”• User Control : SelectBuilding (c) ( I have to create the control inheriting the said Class HAS to be inherited the BaseSelectClass. So “c” inherits “b” )
o In my control I have button with events to be fired. So I delegate them as following.
public delegate void SubmitClickedHandler(string strValue);<br />
<br />
public event SelectBuilding.SubmitClickedHandler SubmitClicked;
In the page load of the parent form I check if its not page load
Else<br />
{ SelectBuilding.SubmitClicked += new SelectBuilding.SubmitClickedHandler(SubmitClickedHandler_Submit);<br />
}
My standalone version of user control that inherits “a” directly works absolutely fine, but it halts in the above scenario. And I have to use the above method to use the User-Control. Could somebody please help me in understanding my mistake above.
P.S. Please feel free to call me if you have time and feel like you need more info.
Very Thanks.
Regards
Sandesh
sandesh27uk@gmail.com
Sandesh Kadam
Tel. No. +44(0) 1753-711936
Cell. no.+44(0) 7818203452
|
|
|
|
|
I have just started worrking with Visual C# and I have just begun to read/write from an Access database. The application I built with guidance from the book I am using brings up all records in a database where you can scroll through, etc. The problem i am having is when i add a new record - the book doesn't show me how to check to see if the record already exists before adding it. The functionality I'm using in this application is ADO.net. Here is a code snippet from the book if that helps at all. I apologiz if i'm not being clear but i am really new to all this. Thanks for any help you can give.
DataRow drNewRow = m_dtContacts.NewRow( );
drNewRow[“ContactName”] = txtNewContactName.Text;
drNewRow[“State”] = txtNewState.Text;
m_dtContacts.Rows.Add(drNewRow);
m_daDataAdapter.Update(m_dtContacts);
m_RowPosition = m_dtContacts.Rows.Count – 1;
Contacts is the name of the Access DB.
|
|
|
|
|
|
TO check if a record exists first you do one of two things
1 - write a stored proc to do your insertions that does the check first
2 - run the SQL to check before you try to do the insert
Of course, if you have all the records in memory in a datatable, you can iterate over it, and I believe you can query it with SQL, too.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello
I'm using Graphviz to generate some diagrams of code relationships within our source code.
I have managed to get passable results with the jpg output, but the font rendering was pretty poor, therefore I changed to svg which produced better images and had the advantage of being scalable.
The next stage of my project is to embed an svg viewer into my C# app using .net2.
Does anyone have any tips or examples I could use?
Many thanks
Paresh
Paresh Solanki
"To the world, you may be just one person, but to one person, you may be the world"
|
|
|
|
|
Well, IE is how you view SVG documents usually, so embedd the web browser control, which is just IE, and will come with the SVG plugin you have installed.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi ,
I am creating a report using rdlc files. I want page break at the end of a group , but not at the end of last one.
In my example , I using a list . I have alreday put the condition for the page break , but its giving page break at the end of last group also , which i dont want.
Please let me know , how to proceed .
Thanks in advance ,
Vikram
|
|
|
|
|
I have troubles getting data out of a repeater. I know that it is not possible to retrieve data from repeater, so I used to read out every control in it.
But now I have encapsulated my Controls in the Repeater in a self-made UserControl:
<br />
<tr><br />
<td align=right><br />
<asp:Label id="cap" runat="server"/> :<br />
</td><br />
<td align="left" style="width:99%"><br />
<asp:PlaceHolder id="con" runat="server"/><br />
</td><br />
</tr><br />
code behind:
<br />
public partial class MergedControl : System.Web.UI.UserControl<br />
{<br />
public string Caption<br />
{<br />
get { return (cap.Text); }<br />
set { cap.Text = value; }<br />
}<br />
<br />
public Control Cont<br />
{<br />
get { return con.Controls[0]; }<br />
set { con.Controls.AddAt(0,value); }<br />
}<br />
}<br />
The reason why should be obvious: The Controltype often changes, that is why I hade to make it that way (Any ideas?)
Anyway, I can't retrieve the Value of the Control that is placed in the Placeholder. What am I doing wrong?
|
|
|
|
|
|
I have this code so far on checking collision. It doesn't quite work.
if (Velocity.Y > 0)<br />
{<br />
for (int n = 0; n < 25; ++n)<br />
{<br />
if (Position.Y + Sprite.Height > grassTopBlock[n].Position.Y<br />
&& Position.Y < grassTopBlock[n].Position.Y + grassTopBlock[n].Sprite.Height)<br />
{<br />
if (Position.X + Sprite.Width > grassTopBlock[n].Position.X<br />
&& Position.X < grassTopBlock[n].Position.X + grassTopBlock[n].Sprite.Width)<br />
{<br />
Position.Y = grassTopBlock[n].Position.Y - Sprite.Height;<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
if (Velocity.X < 0)<br />
{<br />
for (int n = 0; n < 25; ++n)<br />
{<br />
if (Position.Y + Sprite.Height > grassTopBlock[n].Position.Y<br />
&& Position.Y < grassTopBlock[n].Position.Y + grassTopBlock[n].Sprite.Height)<br />
{<br />
if (Position.X < grassTopBlock[n].Position.X + grassTopBlock[n].Sprite.Width<br />
&& Position.X + Sprite.Width > grassTopBlock[n].Position.X + grassTopBlock[n].Sprite.Width)<br />
{<br />
Position.X = grassTopBlock[n].Position.X + grassTopBlock[n].Sprite.Width;<br />
}<br />
}<br />
}<br />
}
What the problem is, I can never tell if the second statement acts, because every time I try, the sprite moves to the top of the grassTopBlock. Can anyone post (or help?) with some collision algorithm for 2D sprites? thanks
- I love D-flat!
- Need. More. Code.
|
|
|
|
|
So, comment out the code that changes the y position and see if the x position code works alone.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
OK: never mind; I figured it out, fianlly. Thanks for helping, though.
The problem was that the Y value kept checking after a certain limit was supposed to be. I added 1 line and it was fixed.
- I love D-flat!
- Need. More. Code.
modified on Monday, March 17, 2008 7:07 PM
|
|
|
|
|
Hi all,
I've been a regular visitor lately but this is my first message. I (am trying to) program just for fun, not for profit, so please do not be harsh if I'm missing some basic concepts.
Starting from the sample code HiLow posted here by Michael Kitchen (http://www.codeproject.com/KB/game/hilow.aspx), I am trying to extend the example to a trick-based game such as spades or bridge.
The code has a Deck class but I need to create a Hands class aswell. For storing the cards that have been dealt, i created a class:
public class Hands<br />
{<br />
public int[,] PlayerHands = new int[4, 13];<br />
public Hands()<br />
{<br />
}<br />
}
The field PlayerHands [4,13] (i hope the dimensions are right) will store the four hands dealt from the deck.
Now, for dealing the cards I made a nice for loop, and it's working.
The problem is that the loop can work as far as I see in two ways:
A. like a void "procedure" - meaning I pass a Hands object to the "procedure" and it fills the correct field (array) with values, and returns nothing.
In this case I deal the cards this way:
TheDeck.DealHands (TheHands);
B. like a function - meaning I assign it's result to the Hands object (if it retunrs a hands object) or more likely to the playerhands field (array) of the hands object - in this case the return is an array of integers.
TheHands.PlayerHands = TheDeck.DealHands();
C. there was a third way, that was quite stupid, dealing the Hands in the constructor of the Hands class (with TheDeck passed as argument) - that was stupid because each new game meant the creation of a new instance of the Hands instead of re-using the same object variable.
Please help me decide which is better. Please note, both versions really work. I've tried to clean the code below of unnecesarry statements. If somethinf looks wrong I might heve deleted too much...
A. code in the first case:
public partial class Form1 : Form<br />
{<br />
private Deck TheDeck;<br />
private Hands TheHands;<br />
public Form1()<br />
{<br />
TheDeck = new Deck();
TheHands = new Hands();
}<br />
private void buttonPlay_Click(object sender, EventArgs e)<br />
{<br />
TheDeck.Shuffle();<br />
TheDeck.DealHands(TheHands);<br />
Invalidate();<br />
}<br />
}<br />
<br />
<br />
public class Deck<br />
{<br />
private int[] CardArray = new int[52];<br />
public Deck()<br />
{<br />
for( int i = 0; i < 52; i++ )<br />
{<br />
CardArray[i] = i;<br />
}<br />
}<br />
<br />
public void DealHands(Hands passedHands)<br />
{<br />
for (int j = 0; j < 13; j++)<br />
{<br />
for (int i = 0; i < 4; i++)<br />
{<br />
passedHands.PlayerHands [i,j]=CardArray[4 * j + i];<br />
}<br />
}<br />
}<br />
}<br />
}
B code in the second case:
public partial class Form1 : Form<br />
{<br />
private Deck TheDeck;<br />
private Hands TheHands;<br />
public Form1()<br />
{<br />
TheDeck = new Deck();
TheHands = new Hands();
}<br />
private void buttonPlay_Click(object sender, EventArgs e)<br />
{<br />
TheDeck.Shuffle();<br />
TheHands.PlayerHands = TheDeck.DealHands();<br />
Invalidate();<br />
}<br />
}<br />
<br />
<br />
public class Deck<br />
{<br />
private int[] CardArray = new int[52];<br />
public int[,] PlayerHands = new int[4, 13]; <br />
public Deck()<br />
{<br />
for( int i = 0; i &lt; 52; i++ )<br />
{<br />
CardArray[i] = i;<br />
}<br />
}<br />
<br />
public int [,] DealHands()<br />
{<br />
for (int j = 0; j &lt; 13; j++)<br />
{<br />
for (int i = 0; i &lt; 4; i++)<br />
{<br />
PlayerHands [i,j]=CardArray[4 * j + i];<br />
}<br />
}<br />
return PlayerHands;<br />
}<br />
}<br />
}
for me, both ways look to have same result but which one is better or more efficient please?
Thanks in advance.
Paul
|
|
|
|
|
Hi Paul,
Welcome to the forums! I'm just trying to get my head around what you're trying to do here. Firstly, hands - are these players? Are we assuming four players here? Also, what version of .NET are you using?
Regards,
Rob Philpott.
|
|
|
|