|
Hello,
I am new on C#, and I have a problem.
O make a form1 with listview,and i polulate this listview whit some Items.
Then I make another form2 with a button, just for count the items on Listview.
I create one function on Form1:
public void UpdatePart()
{
MessageBox.Show(listView1.Items.Count.ToString());
}
In form2 I create a Button:
private void button1_Click(object sender, EventArgs e)
{
Form1 a = new Form1();
a.UpdatePart();
}
So, this count return always 0, but the listview on form1 is not empty, If I call
the same function but on the same form1, the code work and return the items numbers on listview.
What is rong ?
Thanks
|
|
|
|
|
|
Thank you, I will check
|
|
|
|
|
In addition to following Richard Deeming's excellent advice, see this recent answer to a similar problem: [^]
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
I HAVE BEEN CREATED THE INTERNET DOWNLOAD MANAGER.
I AM USING METHOD FOR FILEDOWNLOADASYN
HOW TO CREATE PAUSE,RESTART PROGRAM SIR?
|
|
|
|
|
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalization if you want to be taken seriously.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Are you using WebClient.DownloadFileAsync? If so, you can't pause and then restart from that point. You would have to cancel the existing download and then start again with a new one.
This space for rent
|
|
|
|
|
Easy , turn your caps lock off - simples
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Message Closed
modified 8-Jan-19 9:42am.
|
|
|
|
|
|
A textbox is not meant to display "binary" code, and HEX-codes as your other post suggests are not a form of binary. There's quite some examples on how to convert a byte to hex in C#, but if you want the data in a nice transmittable form, you'd be better of converting it to Base64.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Define "result:" exactly what type of information do you want to display in the TextBox ?
Don't use ArrayList: it's an older data structure that uses a lot of memory: use an array.
Study these links and code:
public static byte[] ImageToByteAry(Image image, ImageFormat format)
{
var stream = new System.IO.MemoryStream();
image.Save(stream, format);
stream.Position = 0;
return stream.ToArray();
}
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
I have this home project... at home.
It has lots of project.
I am also using Nuget to get some 3rd party library.
One of this Nuget package in particular contains 6 DLLs.
It is used in 4 projects... (a bit messy to update)
Now one of this DLLs has a nasty bug. Fortunately the source is on Github!
Is there an easy way for me to debug this single DLL with my project? Without having to mess up with my Nuget packages?
|
|
|
|
|
If you can download the source from Github you can reference the project directly - it may all fall apart if the other 5 DLLs are referencing (never had to attempt that) it internaly.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Oh.. it turns out I can remove the DLL reference without removing the Nuget package!
After that I can reference the project and Bob is your uncle!
Well.. just gonna continue testing my app until I meet this error again, sweet, thanks!
|
|
|
|
|
so basically I want my 3rd party program (which will be created using c# on WPF) be an interface between the user and that site. Using WebBrowser class I wanna load the login page and after the user logged in(and passed CAPTCHA), he/she will fill some fields in the program, and the program will use those data to fill the website fields.
after the user logged in to that website how can my program use his/her cookies to be able to access his/her profile to fill its fields?
|
|
|
|
|
It's quite possible that you can't - the info doesn't have to be stored in cookies, it can be stored in the Session which is entirely server based.
And even if you can, I'm not sure it's something we should be involved in: sites add CAPTCHA to prevent apps from accessing an entire site and / or submitting data automatically, and what you are asking is effectively bypassing that.
If you have a genuine need, then contact the site admins and ask them: they may give you a simple method (or tell you to go to hell).
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Can anyone help me understand this. not too much luck finding anything in google?
using the following code to display a image in a button works fine
button1.Image = global::AppInfo.Properties.Resources.MyImage;
But if I trying to display the image on a windows Form listbox, it does not work
listBox3.Items.Add(global::AppInfo.Properties.Resources.MyImage);
This only displays "System.Drawing.Bitmap" text
many thanks in advanced
|
|
|
|
|
|
If you add it to a listbox as an item, it will try to find a string-representation of your object. The thing it is displaying means it is working, and correctly. If you want images TO the items, try the Listbox.ImageList . There's an example on MSDN.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
You may get more helpful replies here if you describe what the bitmaps you want to display are ... are they icons; do they vary in size, etc. ?
Start here: [^] and figure out:
1. would using a ListView or DatagridView be a better choice
... if not ...
2. would the facility to use an 'ImageList with the ListView do what you want
... if not ...
3. are you willing to take on drawing the graphics yourself ... sub-classing the ListView and owner-drawing ... see: [^]
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
I have an event right:
private void dataGridView1_SelectionChanged (object sender, EventArgs e)
{
}
I would like to trigger an event when it is made:
private void dataGridView1_RowContextMenuStripNeeded (object sender, DataGridViewRowContextMenuStripNeededEventArgs e)
{
}
Simply that the RowContex event worked with SelectionChanged ...
I searched the Internet and these mean me on average: |
If you can, it can be an example of how to do it?
|
|
|
|
|
It's not a good idea, or even really necessary.
Instead of messing about trying to force events to occur, put the code in your event handler inside a separate method and call it from both locations. That way, you don't need to "force" events to happen (which is rarely a good idea) and you reduce the code in your event handler which is a good idea from a style POV.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
it can not be otherwise. I created a dynamic DGV fill and it does not support the RowContextMenuStripNeeded event and the SelectionChanged event as much as possible. I also wanted calling the SelectionChanged event to involve calling the RowContextMenuStripNeeded event. So how to do it? except that it is not a good idea, etc.
|
|
|
|
|
Sure.
private void DoWork()
{
}
private void dataGridView1_SelectionChanged (object sender, EventArgs e)
{
DoWork();
}
private void dataGridView1_RowContextMenuStripNeeded (object sender, DataGridViewRowContextMenuStripNeededEventArgs e)
{
DoWork();
}
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|