|
call Refresh() of that control to redraw
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi
i want to add multiple controls to my form at runtime, for example, i have a single button on my form, when i click this button, the second button add to my form, again, when i click on first button, the third button add to my form and so on, this code is something like this :
private void button3_Click(object sender, EventArgs e)
{
Button btn = new Button();
btn.Location = new Point(this.button3.Location.X + 80, this.button3.Location.Y);
this.Controls.Add(btn);
}
but the above code add only the first button at runTime and when i click again on button3 (in this example), the third button does not add to form. i think that it's couse by name of the controls which being create and it should have dynamic name for that control.
can anybody has experience in this issue ?
how to solve my problem ?
Thanks
|
|
|
|
|
Looks like your building buttons on top of each other.
Isn't it always going to set the location to the same place for every button?
|
|
|
|
|
I would suggest:
1. Finding the previously added button and setting the new X relative to that through iteration/foreach.
2. Referencing the last control in the Controls list (might be the last one) using the length/count of the list.
modified on Sunday, February 22, 2009 9:12 AM
|
|
|
|
|
Thanks Member 3493799
but i think beacuse the third control has a same name with second control, it does not create third control.
|
|
|
|
|
Set the name property different for each control added.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
You are not giving the new button created a click handler.So it does not know what to do when clicked.
|
|
|
|
|
Hi,
every time you click button3 you are creating and adding a new button. That is fine, except:
1. all new buttons are at the same location, so you will only see one of them.
2. none of them will do anything when clicked, since you did not do any btn.Click+=...
BTW:
1.the code to add controls at run-time can be identical to the code Visual Designer adds to your
<myform>.Designer.cs file when adding a control at design-time.
2. the Name property of a Control is often not important at run-time; the Designer uses it at design-time.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Getting compile (Overwritten area/contains Object field @ offset 21)
I want a string that is of length 11 (sender) and a string that is of length 23 (message).
Any help is appreciated; I cant see the problem.
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 66, CharSet = CharSet.Ansi)]
public struct chat
{
[FieldOffset(0)]
public int packetType; //4
[FieldOffset(4)]
public int packetNumber; //4
[FieldOffset(8)]
public int packetSource; //4
[FieldOffset(12)]
public int packetDestination; //4
[FieldOffset(16)]
public short packetPort; // 2
[FieldOffset(18)]
public ushort packetInfoEnd; // 2
[FieldOffset(20)]
public byte dataId; // 1
[FieldOffset(21)]
public string dataSender; // 11
[FieldOffset(32)]
public byte dataPadOne; // 1
[FieldOffset(33)]
public string dataMessage; // 23
[FieldOffset(56)]
public short dataPart; // 2
[FieldOffset(58)]
public int dataEndCodeOne; // 4
[FieldOffset(62)]
public int dataEndCodeTwo; // 4
public chat(int dst, short port, string sender, string message)
{
packetType = 1192961;
packetNumber = 0;
packetSource = 0;
packetDestination = dst;
packetPort = IPAddress.HostToNetworkOrder(port);
packetInfoEnd = 43521;
dataId = 10;
dataSender = sender;
dataPadOne = 0;
dataMessage = message;
dataPart = 206;
dataEndCodeOne = 10209786;
dataEndCodeTwo = 6658;
}
}
|
|
|
|
|
Hi,
in .NET a string is a reference type, so a struct (or anything else) containing a string is actually containing a reference (similar to a pointer), which must and will be "naturally aligned", that is at an offset which is a multiple of 4 or 8.
If you must have the content of an array or even a string embedded inside the struct, you can try this:
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=32)]
public string dmDeviceName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=15)]
public int[] data;
that effectively turns reference types into value types as far as storage allocation goes.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:29 AM
|
|
|
|
|
Thank you! It worked perfectly! Very much appreciated
|
|
|
|
|
Just a note for anyone else who comes across this issue and sees this thread:
The solution provided by Luc does NOT WORK with LayoutKind.Explicit, it only works with LayoutKind.Sequential, and with the FieldOffset()'s removed (obviously).
This is the compiling + working code:
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 66, CharSet = CharSet.Ansi)]
public struct chatOne
{
public int packetType;
public int packetNumber;
public int packetSource;
public int packetDestination;
public short packetPort;
public ushort packetInfoEnd;
public byte dataId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)]
public string dataSender;
public byte dataPadOne;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 23)]
public string dataMessage;
public short dataPart;
public int dataEndCodeOne;
public int dataEndCodeTwo;
public chatOne(int dst, short port, string sender, string message)
{
packetType = 1192961;
packetNumber = 0;
packetSource = 0;
packetDestination = dst;
packetPort = IPAddress.HostToNetworkOrder(port);
packetInfoEnd = 43521;
dataId = 10;
dataSender = sender;
dataPadOne = 0;
dataMessage = message;
dataPart = 206;
dataEndCodeOne = 10209786;
dataEndCodeTwo = 6658;
}
}
|
|
|
|
|
The blow code is one of the 4 billion different tries of mine to get this working without help.
The cookies just don't work. The session is not persistent because it doesn't send the original cookies with the next request.
I've read that sometimes they get jumbled because of issues with maybe a comma in the cookie, but I have no idea if that is the problem or how to fix it...
CookieContainer CC = new CookieContainer();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://example.com");
request.CookieContainer = CC;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
CC.Add(response.Cookies);
request = (HttpWebRequest)WebRequest.Create("http://example.com");
request.CookieContainer = CC;
HttpWebResponse response2 = (HttpWebResponse)request.GetResponse();
|
|
|
|
|
Can anybody help me at all?
|
|
|
|
|
I simply want to process sql statement from the background by opening a popup window. After the process I want to close the window by itself w/o any interaction from the user.
I added this code in the code behind but it ask for questions "Do you want to close the window?" I don't want confirmation.
Response.Write("<script language='javascript'> { self.close() }</script>");
Thanks
Dabsukol
|
|
|
|
|
A quick Google search[^] gave me a few ideas.
I didn't try it but maybe this[^] should do the trick.
|
|
|
|
|
this.Close(); Usually works for me, at least this is the command I always put in the close buttons.
Also, self is VB iirc, not C#. In C# you need to use this .
|
|
|
|
|
hello... i have a datagrid view which takes a query from the database and displayes some data. not is it possible to display the same datagridview contents in a report... ??? thankyou...
|
|
|
|
|
max.4u wrote: i have a datagrid view which takes a query from the database and displayes some data
Does your datagrid have a datatable as a datasource?
max.4u wrote: is it possible to display the same datagridview contents in a report
If it does, you can use that datatable (or dataset) as a source for Reporting Services or Crystal Reports
|
|
|
|
|
my datagridview has a dataset. i tried by adding the dataset to the crystal reports from the wizard and its showing the data in the dataset.
but all i need is that my dataset is having a query which shows only a part of the data rather than all the data in the database.
so i need a way to call the query from the dataset.. thankyou..
|
|
|
|
|
I'm writing a program that tracks a moving objects in a mpeg file. I'm using AForge.net. I'm new to c# and programming. I cannot get to play the video. For right now I want to play the video in a picture box and cature new and old video frame to compare the movements. Here is my code so far that does not work.
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
How do I get to play the video in the picture box?? }
private void button1_Click(object sender, EventArgs e)
{
videoSource = new FileVideoSource(videoFile);
//videoSource.
//videoSource.NewFrame += new AForge.Video.NewFrameEventHandler(video_NewFrame);
videoSource.Start();
}
private void video_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
{
Bitmap bitmap = eventArgs.Frame;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog.Filter = "Video (.mpeg)|*.mpeg|(.avi)|*.avi|ALL Files (*.*)|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
videoFile = openFileDialog.FileName;
}
}
Help anyone please:kathsunil
Posts: 1
Joined: Wed Feb 18, 2009 11:56 am
Private message
|
|
|
|
|
|
helo... am too working on the same kind od project... and my project has a windows service whicl listens the client requests on a port and then sends the messages to the client.
the client has a form which has a login mod which when provided with the user and password it sends to the server and authenticates at the server and then sends back the result.
and the client also secretly monitors the websites and the applcations visited by the user and sends the activity to the server at a fixed duration and the server logs in the data in to a db.
it will b completed within 5 or 6 days.. and regarding the udp connection you have used are you deploying the sys in LAN or INTERNET ? if its in lan then tcp type of connection is recommeneded, ... request if any help needed.... bye
|
|
|
|
|
|
I'm not sure what you've got at the moment, but you could use something like:
Process proc = Process.Start("Stuff");<br />
proc.MainWindowHandle ...
maybe you can find something useful in proc.MainModule and proc.Modules
And if not, there's always FindWindow[^] and FindWindowEx[^] which should let you grab the windows your looking for.
EDIT: And conveniently, I think the question below has some code that uses FindWindowEx so if your unsure on how to use it, there it is.
My current favourite word is: Delicious!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|