|
Your UpdateDeviceHistory method is static. But you are trying to access m_parent. You can't do that. Because m_parent is not static. To be more specific context of your program is needed but you could do this at least:
1. Remove static from your UpdateDeviceHistory method.
2. create Utility class instance and call UpdateDeviceHistory on that instance, that is:
Utility utility = new Utility(some_form_with_HistoryDataView)
utility.UpdateDeviceHistory()
Good Luck
Vitaliy Tsvayer
Tikle
|
|
|
|
|
hello guys!
i'm having some issue figuring out what to use for my application.i'm developing a desktop application pulling most of its data from websevices.I display the data which can be huge with a datagrid.
i have a webservice datasource and bind that datasource to the grid.
Now i want to give better user experience and feedback to users.The method i found online for the backgroundworker with the progressbar is not satisfactory enough.Actually they use loops to give the reportprogress the percentage to show while in my implementation i can't put webservice calling into a loop.I'll like to use the webservice async call with the progress bar but then i don't know how to update the progress bar to display the appropiate percentage.So if anybody can point me to a ressource or a workarround i'll be more than glad.I 'm open to suggestion so please let me know what you think.
Thanks for reading this.
eager to learn
|
|
|
|
|
Well it depends on whether you have one web service call through which you get all your data or you have multiple separate web service calls to get your data. In the first case it won't be easy to update progress as web service needs to get the whole XML data before it can be parsed etc etc. It can be asynchronous but without progress updates. In second case BackgroundWorker is really suitable here. You do not need any loops as it is shown here http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[^]. You simply call ReportProgress() method to update current progress between your web service calls and handle ProgressChanged events to update progress bar. Hope this helps somehow.
Vitaliy Tsvayer
Tikle
|
|
|
|
|
Thanks vitaliy.Your suggestion helps but for some reason the progress bar is not updated at all since i have only one web service per form.Thank any way.
eager to learn
|
|
|
|
|
|
hello everyone!
beginner Q!
i try to build an array, by btn click i like to add integer;
my problem is every click i get a new array, so where i need to declare my array
the code:
namespace array
{
public partial class _Default : System.Web.UI.Page
{
int counter;
int[] arr1 = new int[50];
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnAdd_Click(object sender, EventArgs e)
{
int item = int.Parse(TextBox1.Text);
addItemToArray(item);
counter++;
}
public void addItemToArray(int item)
{
arr1[counter] = item;
}
}
}
10x
Kaka760
|
|
|
|
|
the button is a server side control, so the page reloads everytime you click it, try using java script for the button.
|
|
|
|
|
The reason you get new array object on every click, is that new instance of class _Default is created for every request. So you need to put this array object into store which is shared among different requests that is Session.
Vitaliy Tsvayer
Tikle
|
|
|
|
|
Here, I have two images.... both of which has transparency in it.... They look a bit like this....
http://img167.imageshack.us/img167/1263/piece00.png
http://img129.imageshack.us/img129/9712/piece03.png
Language I am coding in is C#.
I am trying to overlap these two images(or the puzzle pieces) such that the result looks like that they fit into one another.....
I have tried all sorts of things to do it but failed. I have put these 2 images into 2 pictureboxes and set the backcolor as transparent but tht didnt worked....
code:
PictureBox[] p = new PictureBox[2];
p[0] = new PictureBox();
p[1] = new PictureBox();
p[0].BackColor = Color.Transparent;
p[1].BackColor = Color.Transparent;
p[0].Size = new Size(100, 100);
p[1].Size = new Size(100, 100);
p[0].Location = new Point(100, 100);
p[1].Location = new Point(180, 100);
p[0].Image=(imageList1.Images[0]);
p[1].Image=(imageList1.Images[1]);
p[0].Visible = true;
p[1].Visible = true;
this.Controls.Add(p[1]);
this.Controls.Add(p[0]);
p[0].Refresh();
p[1].Refresh();
p[0].Update();
p[1].Update();
I have also tried doing the same with buttons using:
button1.BackgroundImage=image1;
button2.BackgroundImage=image2;
But both pictureboxes and buttons resulted in something like this:
http://img148.imageshack.us/img148/5701/try1.jpg[^]
|
|
|
|
|
have you tried this? draw both images on to the same bitmap and display them in a picture box more like this,
Bitmap=bmp new Bitmap(100,100);
Graphics gr=Graphic.FromImage(bmp);
gr.DrawImage(img1,0,0,...
gr.DrawImage(img2,0,0,...
PictureBox p=new PictureBox();
p.Image=bmp;
Might work!!!
GoodLuck
|
|
|
|
|
Yes I have tried tht... but it didnt work as it was also putting the transparent pixels also in the bmp formed...and i was skipping the transparent pixels than it was also skipping the transparent pixels at the bottom of the image...
Isnt there any image container tht let see through the image on to the image behind it.... ofcourse picturebox and button isnt working or am I doing something wrong?
|
|
|
|
|
|
Hello,
I'm attempting to enumerate the contents of a registry key: HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop
I am currently storing the Name in an array without a problem.
However, how do I store both a REG_BINARY (byte) and a REG_DWORD (int) into an array?
Here is the code, that is failing:
<br />
RegistryKey myRegKey = Registry.CurrentUser;<br />
myRegKey = myRegKey.OpenSubKey("Software\\Microsoft\\Windows\\Shell\\Bags\\1\\Desktop\\");<br />
String[] valueNames = myRegKey.GetValueNames();<br />
<br />
string[] OriginalValueName = new string[valueNames.Length];<br />
Byte[] OriginalValueData = new System.Byte[valueNames.Length];<br />
<br />
int i = 0;<br />
foreach (String valuename in valueNames)<br />
{<br />
MessageBox.Show(valuename);<br />
OriginalValueName[i] = valuename;<br />
<br />
Object ovalue = myRegKey.GetValue(valuename);<br />
MessageBox.Show(ovalue.ToString());<br />
<br />
if (ovalue.ToString() == "System.Byte[]")<br />
{<br />
OriginalValueData[i] = (System.Byte)ovalue;<br />
}<br />
else<br />
{<br />
OriginalValueData[i] = (System.Byte)ovalue;
}<br />
}
I'm trying to convert an integer to a byte, but it doesn't seem to work, claiming "Specified cast is invalid."
Does anyone have any ideas?
Thanks,
Matt
|
|
|
|
|
Hi,
how could you store an int value (32-bit) in a byte (8-bit) in a useful manner?
You could:
1. do the opposite, i.e. store bytes and ints into an int[].
2. better yet, define your own type ("RegistryValue") and derive two types from it ("RegistryByte" and "RegistryInt"), then store instances of either one of them in an array, or better yet a List< RegistryValue>. Making it a class/struct allows for additional information such as the key name.
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
|
|
|
|
|
Luc Pattyn wrote: how could you store an int value (32-bit) in a byte (8-bit) in a useful manner?
By using the Obi Wan Kenobi Bit Cramer[^]
It's that pretty blue thing he is holding.
|
|
|
|
|
Extreme tools should be used in emergencies only; don't waste them on a couple of bits, spending some RAM is more than adequate.
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
|
|
|
|
|
Ahh.... i see...
Sorry, I'm new. Every post I post here is like an awakening.
Appreciated,
Matt
|
|
|
|
|
Ahhh... much better... dang datatypes.
RegistryKey myRegKey = Registry.CurrentUser;<br />
myRegKey = myRegKey.OpenSubKey("Software\\Microsoft\\Windows\\Shell\\Bags\\1\\Desktop\\");<br />
String[] valueNames = myRegKey.GetValueNames();<br />
<br />
string[] OriginalValueName = new string[valueNames.Length];<br />
int[] OriginalValueData = new int[valueNames.Length];<br />
<br />
int i = 0;<br />
foreach (String valuename in valueNames)<br />
{<br />
MessageBox.Show(valuename);<br />
OriginalValueName[i] = valuename;<br />
<br />
Object ovalue = myRegKey.GetValue(valuename);<br />
MessageBox.Show(ovalue.ToString());<br />
<br />
OriginalValueData[i] = (int)ovalue;<br />
<br />
}
|
|
|
|
|
Hi,
int may be sufficient, it depends on what you want to do with the data afterwards.
One potential problem is you don't store the original type information, so a key (Paul, 123) may have been a REG_BINARY or a REG_DWORD, so you would not be able to restore registry entries lacking some information.
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
|
|
|
|
|
Ahh okay... I'll store that as well.
Can I store different data types per-dimension in a multi-dimensional array?
|
|
|
|
|
bbranded wrote: Can I store different data types per-dimension in a multi-dimensional array?
No. (i.e. not in the simple way you probably are thinking of; you can as structs/class objects, but then you wouldn't need extra dimensions any more).
Object oriented principles would tell you to store all information about one real-life object (such as a registry key) into one software object, that is why I suggested you make your own type (struct or class) in the first place.
FWIW: It may be wise to buy and study a book on C#, that would give you a head start by teaching you all the relevant principles, explaining them well and illustrating them with examples.
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
|
|
|
|
|
Thanks very much for all of the info.
People keep telling me that I need basics.... hah! Maybe one day...
The data type/struct thing seems very interesting to me, and makes perfect sense.
I'm always getting in over my head... my primary job (and my skill set) is a network and sys admin. I code on the side, and I feel like I'm slowly slipping into coding more... maybe I should buy a book.
Thanks!
|
|
|
|
|
You're welcome.
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
|
|
|
|
|
try using ArrayList in System.Collection namespace you don't even have to check for a type because this collection stores them as objects
for your case
ArrayList OriginalValueData=new ArrayList();
for(...)
{
OriginalValueData.Add(OValue);
}
I hope that would solve ur probles
Good Luck
|
|
|
|
|