|
How can i generate a automatic number each time in c#
sandip chandra
|
|
|
|
|
I recommend you read this[^], and the guide on asking questions. I *think* your question is easily answered by google, but it's hard to know for sure, because I'm not entirely sure what you're asking. You want to generate what sort of number ? How does it change ? How long does the sequence maintain state ? What for ?
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 )
|
|
|
|
|
|
What about Random class?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Following is the code that illustrates the use of events and delegates.
There is a common thing that is use by both the event and delegates.
I know the basic differece between them (events can be declared in the interfaces.)
But in the following example , I think , I can simply go with only delegates , and no need to use the events
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace WindowsApplication1<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
d ddd = new d();<br />
ddd.sd(20);<br />
ddd.fireevent(10);<br />
}<br />
} <br />
}<br />
<br />
namespace WindowsApplication1<br />
{<br />
public delegate void smartdelegate(int i);<br />
public class d<br />
{<br />
public smartdelegate sd;<br />
public event smartdelegate smartEvent;<br />
public void fireevent(int i)<br />
{<br />
smartEvent(i);<br />
}<br />
public d()<br />
{<br />
sd = new smartdelegate(aa);<br />
smartEvent = new smartdelegate(aa);<br />
}<br />
<br />
private void aa(int i)<br />
{<br />
System.Windows.Forms.MessageBox.Show(i.ToString());<br />
}<br />
}<br />
}
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Pankaj Garg wrote: public d()
{
sd = new smartdelegate(aa);
smartEvent = new smartdelegate(aa);
What is the point of this ?
Pankaj Garg wrote: d ddd = new d();
ddd.sd(20);
ddd.fireevent(10);
If you're not going to hook up your delegates on this level, you're wasting your time. If the event is inside the class that fires it, then you can just call it from there.
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 All,
I have written a code in C# win form that will browse all network, domain in that network, machine in the selected domain and share and folder under the selected machine. But the problem is the code runs under the logged on user credentials. If the logged on user does not have permission on the given folder it shows access denied. I want to pop up "connect to" dialog box which windows shows when we try to connect to different machine? Can anybody tell me how to do this? How to pop up the connect as box?
Jayant D. Kulkarni
|
|
|
|
|
Hi,
i have tried this line in my project so i can get the path of the
images for storing them later in the SQL table but it did not work:
byte[] imageData = ReadFile(txtImagePath.Text);
I get an error 'ReadFile' does not exist in the current context.
In which class does this method belong?
Thanks..
|
|
|
|
|
|
Read this[^].
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 ReadFile is method man,
but u miss that signature in ur class.
check ur code
|
|
|
|
|
I know it's a method and i'm asking if it's a predefined
method in one of the imported namespaces and if yes
which one?
|
|
|
|
|
|
I skipped the ReadFile method and used something else instead. This is my code so far:
try
{
byte[] image = new byte[4];
string qry = "insert into ITEM(item_picture) values(@OriginalPath)";
command = new SqlCommand(qry,connection);
command.Parameters.Add(new SqlParameter("@OriginalPath","~/images/app1.jpg"));
}
finally
{
connection.Open();
command.ExecuteNonQuery();
connection.Close();
}
I'm trying to execute this within a method every time i add a picture in the table.
The table is called ITEM and the column with the type image is called item_picture.
And the application root is ~/images/ where i have stored all the images.
I get the following error:
Operand type clash: nvarchar is incompatible with image
Thanks
|
|
|
|
|
I need the start menu to appear when a use clicks on a button. The thing is that it needs to appear where the button that the user clicked is.
I have looked at making it so that when the button is clicked it spawns a keypress event for the window button but that would act like just pressing the button. It would appear down in the corner.
Can anyone help me here?
modified on Sunday, March 16, 2008 7:43 PM
|
|
|
|
|
Rewrite the OS. Good luck, let us know how that turns out.
only two letters away from being an asset
|
|
|
|
|
hehe
I've seen it done before though in multiple programs where you click a button and the start menu appears wjere you clicked it.
|
|
|
|
|
I have never seen it. Nor can i imagine it being done easily... or in C#. Thats even if it really is possible.
What you could do on the other hand, is re-create the start menu. You can find through the windows registry, all of the shortcuts and things that are in the start menu, and look up the start menu folders to see what shortcuts are there.
Then, you could get the users current theme and use that to draw up your own start menu. How you would go about getting and using graphics from the currently applied theme is beyond my knowledge.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
here is what I want in action:
http://i86.photobucket.com/albums/k93/tadadalol/untitled-1.jpg
I know of one more program that can do the same thing.
P.S. Yes I know it all looks pretty.
P.P.S. I am very into the customizing the look of XP. The program being showed is one I've picked up in my adventures of customizing. The other program I be talking about has also come onto my computer throught the same way.
|
|
|
|
|
Well, maybe there is a DLL somewhere for the start menu, or the is a command you can send to explorer or... i don't know. I can't find anything.
What you could do of course, is kindly e-mail the company/person who made the application or whatever and simply ask them how they did it.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Well if you look you can see it isn't the real Start menu, only a representation of it as rendered by the application that is generating it.
only two letters away from being an asset
|
|
|
|
|
Here is an idea for you. Create a transparent top level window, or take a screen shot of the screen and paint that on the most top level window so it looks as if there is no additional window. Now when the user clicks, this window will receive the mouse click event, which then you could force feed the start menu a mouse click event. Make sure your top level window is minimized or moved to the back when the start menu gets its message from the queue, you can do this by doing something with the top level window before you throw the message in the queue. Take a screen shot of that and redraw it on your window. You are going to need to translate the mouse pointer coordinates and programatically move the mouse back and forth. Its going to be a crap shot but it will get you closer to your magic start menu.
Or you could simply locate the variables in memory that determine the location of the start menu window, it would require a bit of peeking and poking, but I'm sure you could find a universal driver designed for that and take advantage. Anything is possible with a computer if you set your heart to it.
The Digital World. It is an amazing place in which we primitive humans interact. Our flesh made this synthetic machine. You see, we are so smart, we know a lot of stuff. We were grown from cells that came from the universe, which the matter and physics I'm typing in it is amazing how the universe is working. Human life is very amazing. How I experience this sh*t its like wow.
|
|
|
|
|
Here is an idea how to do it: When user presses on your button show the start menu. Find the handle of start menu window using P/Invoke and then move the window using some other win api functions such as MoveWindow.
Here is an interesting article: Move Start Button[^]
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Hi,,
I have a C#.net windows application with a datagridview.I need to export datagrid's data to Excel sheet.
How to export from DatagridView to Excel Sheet in C# Windows Forms?
Anybody has sample code in C#?
Please Help!!!!!!
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
Google not working for you? a simple search with your post's title points to many useful resources.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|