|
str variable has the memory address of the location where "rahul" is stored.
The value assigned to a string variable is stored in the heap, and its address is stored in the stack.
|
|
|
|
|
This is not C. You're creating an instance of a class, which then contains the value "rahul". If you create a byte array, you can create the same effect as a char * in C, where you're storing the values themselves. Of course, .NET can move your objects in memory, so you'd have to pin the memory before being sure the string will stay in the same location.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
The most idiotic and selfish thing to do in these forums is to delete your question after getting the answer!!
This's a good reason why we have to quote at least part of the question!!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I donno..this is the first time i became member of this forum..i thought it
should be deleted..
|
|
|
|
|
Welcome aboard Rahul!
Please familiarize your self with cp rules.
Here are some:
- No CAPS!!
- No URGENTs
- No Question post deletion
- No inter-forum posting
- No post repetition
Have a good time
oh, one more rule..
- If someone answered your question, give them 5, so people with the same inquiry could easily find the correct answer among the replies, and to help these people how helps us on their way up to be MVPs here in the cp.
Cheers
-- modified at 3:36 Wednesday 16th May, 2007
-- modified at 3:39 Wednesday 16th May, 2007
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
hey..
i am currently working on a C#/openGL drawing application.....drawing is great but I need to incorporate functionality to select and edit lines with the help of mouse...plz suggest good tutorials from your expereince
cheers
|
|
|
|
|
Because a line is not an object, you will have to write your selection process from the ground up. You will have to register the points contained by lines (perhaps recognizing members from end points for instance); detect clicks or other process you might provide for selecting lines; and then perhaps re-draw the line/polygon/etc... to indicate it has been selected. A process you might use to select graphic elements could be to iterate through a list of the elements your processes have drawn, re-drawing each to indicate selection as the list is iterated by arrow keys, navigation buttons, or whatever.
|
|
|
|
|
Hello everyone,
I need to add the option of uploading image into a remote database server to my Windows Application. I have been reading about it and it appears there are different ways to approach this. So far two of the ways that I find intresting are:
1- save the image in the database as type BLOB.
2- upload the file, save it to disk, but store the filename in the database.
I was wondering if for option 2 I have to create a new Ftp instance and then FTP the file to the remote server?!!!
Any ways, I have no clue what so ever and any information regarding uploading images from a Windows Application will be appriciated.
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
1. In the case of using a BLOB, your server side application or RDBMS will be used to store the image to the BLOB field.
2. In the case of uploading the file and storing a reference to the file in your table, yes, you need likewise to send the file to a server side application. It will be the responsibility of the server side application to store the file and register a reference by whatever system is necessary for retrieving the file. Sometimes such resources are distributed to many locations. For instance, a client application might keep the original copy it receives in response to its first request for the file. Later, if it needs the file again, the server application might compare the last modified timestamp of the source file, and only return a message that the copy the client has is current. You would do this for instance to minimize network bandwidth consumption.
|
|
|
|
|
Hi,
I have a ListView to which I would like to add a ContextMenu. There are three different scenarios which I would like to cater for. The first scenario is when the user right clicks in an empty area of the ListView - I want a specific set of menu items displayed. The second scenario is when the user right clicks on one single item in the ListView - I want to show a menu which has some options enabled/disabled due to the actual data object which the user selected. The third scenario is when the user multiply selects rows in the ListView, and right clicks on an item - I want to show a menu which has only some of the items displayed, based on the which items the user has selected.
I also have exactly the same problem with TreeView.
Please help me !!!
|
|
|
|
|
Your problem is conceptualization:
If and only if you can detect the regions which you want to process, can you pull off your job. You can detect whether single or multiple items are selected and which mouse button is pressed, so you can pull of this much of your job. But detecting a click in an "empty area" may not be practical.
You have to work with the component however the component is designed to work with you.
|
|
|
|
|
In our upcoming CMS (zeta producer 8 [^]), I am doing this for both <a href = "http://msdn2.microsoft.com/en-us/library/system.windows.forms.treeview.aspx" rel="nofollow">TreeView</a> [<a href = "http://msdn2.microsoft.com/en-us/library/system.windows.forms.treeview.aspx" target = "_blank" rel="nofollow">^</a>] and <a href = "http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.aspx" rel="nofollow">ListView</a> [<a href = "http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.aspx" target = "_blank" rel="nofollow">^</a>] as you described.
I do handle the SelectedIndexChanged event of the ListView and TreeView and change the ContextMenuStrip property to either of 3 predefined ContextMenuStrip controls.
In Addition I enable/disable menu items in those ContextMenuStrip s based on the content of the selection (i.e. whether a single or multiple items are shown).
This works exactly the same for both TreeView and ListView .
|
|
|
|
|
i've a cross thread problem
i searched the net alot and i still can't solve it
here is a complete sample of the code
WaitCallback callback ;string username;
fn(object sender,eventargs e )
{
callback = delegate(object state) { this.ExcuteFN(); };
}
void ExcuteFN()
{
//MethodInvoker.Combine(callback);
try{
this.usertableadapter.insert(textbox2.text,combox1.selectedvalue);}catch(){}
finally{textbox1.clear();}
}
the problem that another thread is accessing the control that created by main thread
ofcourse i don't want the dirty solution to stop the control check
i tried the
MethodInvoker.Combine(callback);but no way, i tried many other solution but also no way
any solution plz provide full details
|
|
|
|
|
I use the (from memory) WorkerThread class all the time now. It has callbacks to the main thread which I can use to do any UI updates that need to happen during and after the thread.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
You mean BackgroundWorker?
|
|
|
|
|
No i'm working with (WaitCallback )delegate
its equivlant to backgroud worker but more better
|
|
|
|
|
WaitCallback is a delegate. BackgroundWorker is a component that helps you update UI controls on the right thread while still doing background work on another thread. See this article[^].
|
|
|
|
|
ummm, what i know is the invokerequired property but this is for windows forms controls, and i see use tabledataadapter.
to use invokerequired:
delegate void MyDelegate(object Data);
void some method()
{
.........
if(Control.InvokeRequired)
{
YourControl.BeginInvoke(new MyDelegate(this.controlupdatemethod),new object[] {yourdata});
}
}
void controlupdatemethod(object data)
{
//Do Whateve you want here in your control
}
|
|
|
|
|
Ok your in another thread you created...<br />
<br />
<br />
public class HeavyJobThread<br />
{<br />
public delegate void NotifyUI();<br />
public event NotifyUI OnNotifyUI;<br />
<br />
<br />
protected void ThreadProc()<br />
{<br />
<br />
if (OnNotifyUI!= null)<br />
OnNotifyUI.BeginInvoke(null, null);<br />
}<br />
<br />
<br />
<br />
<br />
void HeavyJobThread_OnNotifyUI()<br />
{<br />
NotifyUI();<br />
<br />
}<br />
<br />
<br />
private void NotifyUI()<br />
{<br />
if (this.InvokeRequired)<br />
{<br />
NotifyUICallback cb = new NotifyUICallback(NotifyUI);<br />
this.Invoke(cb, null);<br />
}<br />
else<br />
{<br />
textbox1.Clear();<br />
}<br />
}
.net is a box of never ending treasures, every day I get find another gem.
|
|
|
|
|
Hello Gentlemen.
I'm having a bit of trouble figuring out why a right click control I programmed is not functioning correctly.
Here is my initbutton function for the most part.
public void InitButtons()<br />
{<br />
int counterx = 0;<br />
int countery = 0;<br />
string buttonname = "button";<br />
<br />
for (int i = 1; i <= 81; i++)<br />
{<br />
this.BLISTS.Add(i, new ButtonList());<br />
this.BLISTS[i].ReInitList();<br />
this.button.Add(i, new System.Windows.Forms.Button());<br />
this.button[i].Location = new System.Drawing.Point(173 + (countery * 65), 61 + (counterx * 66));<br />
this.button[i].Size = new System.Drawing.Size(63, 60);<br />
this.button[i].Name = i.ToString();<br />
this.button[i].TabIndex = i;<br />
this.button[i].Text = this.BLISTS[i].ShowNum();<br />
this.button[i].UseVisualStyleBackColor = true;<br />
this.button[i].Enabled = true;<br />
this.button[i].Visible = true;<br />
this.button[i].AccessibleRole = System.Windows.Forms.AccessibleRole.Default;<br />
this.button[i].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Tile;<br />
this.button[i].BackColor = System.Drawing.Color.Ivory;<br />
this.button[i].Cursor = System.Windows.Forms.Cursors.Default;<br />
this.button[i].MouseClick += new MouseEventHandler(this.MouseLRClick);<br />
countery++;<br />
if (i % 9 == 0)<br />
{<br />
counterx = counterx + 1;<br />
countery = 0;<br />
}<br />
Controls.Add(button[i]);<br />
}<br />
}<br />
And here is the event handler:
private void MouseLRClick(object sender, MouseEventArgs e)
{
Button temp = sender as Button;
if (temp != null)
{
if (e.Button == MouseButtons.Right)
{
temp.BackColor = Color.Red;
return;
}
/* if (e.Button == MouseButtons.Left)
{
temp.BackColor = Color.LightGray;
return;
}*/
}
}
For whatever, reason, the button never turns red, never depresses, and the focus never switches. Is there some aspect of the MouseButton.Right I am not understanding here?
Thanks for your time.
|
|
|
|
|
Have you set a breakpoint to see if the event fires ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Not yet. That is a good idea.
|
|
|
|
|
No, it doesn't seem to be fireing. The Event is not even being picked up. I can spam the right mouse button all day, and it doesn't even move into the MouseLRCLick function.
|
|
|
|
|
Override OnMouseDown and detect MouseButtons.Right from MouseEventArgs e:
protected override void OnMouseDown( MouseEventArgs e )
{
base.OnMouseDown( e );
if ( e.Button == MouseButtons.Right )
if ( null != f_RightClick )
f_RightClick( this );
}
|
|
|
|
|
Or (at least) call your MouseLRClick method from OnMouseDown. "Right-click" requires this handling because there is no formal right click event. I haven't tried it lately, but I believe there is some kind of anomalous behavior if you try to detect right "click" (mouse down) in a Click delegate (which may be your experience -- that Click would not fire in response to a right MouseDown/Click).
In other words, you needed to use an event that would be fired by the right mouse button being pressed and/or released within the usual timeframe of a "click" event. I believe, because a right click is not detected by Click, that the OnMouseDown event is your only viable candidate. Generally, your purposes will be able to drop time frame considerations. Otherwise (to qualify a true "click" time frame), you will have to measure the timespan between MouseDown and MouseUp. For almost any usual purpose, this probably is redundant.
|
|
|
|