|
Pretty much impossible with .net I'm afraid. Google for obfuscation and get your wallet out.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I have an application where I am redrawing some images after each second. For this I have written a handler for timer in which i am calling one function which draws image. In timer i am incrementing number and based on the number i am displaying or redrawing image. In OnPaint event these images get displayed. But when I am trying to do this with timer event handler iam unable to display different image. I need to do ALT + Tab and again select the same application then my OnPaint gets called and whaever value of number the same image is get displayed. I want this to automatically displayed in sync with timer. What could be the reason.
|
|
|
|
|
Supra2 wrote: What could be the reason.
You are not calling Invalidate()[^] method. It will redraw the control.
|
|
|
|
|
Hi
I used the following code for listing files
int h=listBox1.SelectedIndex;
if(h==0)
{
try
{
reader = new XmlTextReader("path.xml");
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Text:
String s1;
s1 = reader.Value;
String ss;
ss = listBox1.SelectedItem.ToString();
sss = ss + s1;
object o3 = (object)sss;
DirectoryInfo dire = new DirectoryInfo(sss);
if (dire.Exists)
{
String[] folder;
folder = Directory.GetDirectories(sss);
foreach (string foldername in folder)
{
DirectoryInfo di = new DirectoryInfo(foldername);
if (di.Exists)
{
String[] files;
files = Directory.GetFiles(foldername, "*.exe*");
foreach (String filename in files)
{
lvi = new ListViewItem();
lvi.Text = filename;
listView1.Items.Add(lvi);
lvsi = new ListViewItem.ListViewSubItem();
lvsi.Text = filename.Length.ToString();
lvi.SubItems.Add(lvsi);
}
this.Controls.Add(listView1);
}
}
}
break;
}
}
}
catch (System.Exception err)
{
MessageBox.Show("Error: " + err.Message);
}
}
if(h==1)
{
} The following line gets the selected item from listbox(C:\,D:\...)
ss = listBox1.SelectedItem.ToString(); It works for C:\.When D:\ is selected it again displays C:\ and not D:\
|
|
|
|
|
I think you need to re-think you design. And please use more descriptive variable names. and h can never be both 0 and 1, so your two if statements need to be and else if, or a swicth, or even better get rid of them completely as you never use h in your code so its value has no matter in the output you get.
I am assuming you have a list box with two entries. One c:/ and one d:/, correct? if so then ss (which i assume is getting the drive letter) is not working as you expect, try debuging it with a writeline or messagebox showing its value. if you can confirm this then you can move to the problem being else where.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
itemcode and price are the fields in the table and i use sqldatareader to retreive data, when trying to do this using datareader.getstring(0) it works , but when call datareader.getfloat(1) it gives the exception Specified cast is not valid. i store the price as a float;
what might be the problem
|
|
|
|
|
either the column its referencing is not a float like you say, or your trying to assign a float to a different data type that does not support a cast from a float. does it compile? if not, lets see some code. If it does compile then try debuging by printing the value of the 'float' column as a string and see what value you get, just to check you have the right column
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I had the same problem just last week. Try 'getdouble(1)' instead. It worked for me even though the database type is a float.
-NP
Never underestimate the creativity of the end-user.
|
|
|
|
|
Hello everyone,
I want to programtically play a remote (streamed) video using C#, the purpose is to test web sites performance/stress. No need to have any GUI, just using Media Player API to playback a speific video by URL is fine.
I searched for Windows Media Player API/SDK samples, but all are dealing with GUI, not what I wanted. Does anyone have any good samples to recommend?
thanks in advance,
George
|
|
|
|
|
Well surely if the GUI examples do what you want you can take the relavnt code from them and use it however you want
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi musefan,
All samples I found are too complex and it takes me much time to read and just get simple code to playback. Do you have any recommended simple samples?
regards,
George
|
|
|
|
|
No I dont have any simple samples. Thankfully not all tasks can be accomplished with a single (or very few) lines of code.
Sometimes you have to write alot of code for something that may produce an apparently simple result. If you are having trouble understanding the complexity of the code examples than perhaps you need to take a step back and ask yourself if your doing something that is more advanced than you can handle. If so, then you will want to go back to more simple tasks until you have a better understanding. Or you could just put the time in to understand the example code you already have a learn from that. it really depends on how basic your understanding of the example is or is not.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Could you recommend me some samples to start-with? Either simple or not is fine.
regards,
George
|
|
|
|
|
Sorry i have not done this task before so have no samples and i certainly do not wish to waste my time searching the web and doing the work for you.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks all the same, let use wait for other gurus.
regards,
George
|
|
|
|
|
Hi
I am getting an error like:
Error 1 Unable to copy file "obj\Debug\WindowsApplication32.exe" to "bin\Debug\WindowsApplication32.exe". The process cannot access the file 'bin\Debug\WindowsApplication32.exe' because it is being used by another process. WindowsApplication32
|
|
|
|
|
The error kind of speaks for itself. You have a process that's got a handle to WindowsApplication32.exe and that's preventing you from finishing the compile phase. Take a look in task manager and see if there's an instance of this application running and kill it.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Whenever i have seen that error it is because the application i am trying to debug is still running, look in task manager to see if it is still running and end the task if need be
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
Below is the code which get called during generation of installer
I wanted to retrieve the value of property of SETUPEXEDIR in a string..
Unable to do so.. please help
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace ABC.CustomInstallation
{
[RunInstaller(true)]
public partial class CustomInstallation : Installer
{
public CustomInstallation()
{
InitializeComponent();
}
public override void Install(System.Collections.IDictionary stateSaver)
{
\\-- Here i want to check the SETUPEXEDIR value----\\
if some validation skip next 2 lines...
ConfigurationForm frmConfig = new ConfigurationForm();
frmConfig.ShowDialog();
base.Install(stateSaver);
}
}
}
|
|
|
|
|
i want to add pagination to datagrid?
please help me to do this
|
|
|
|
|
I'm sure there are articles on code project for doing this. Or, use a gridview.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I'm using a System.Net.Sockets.Socket in a server application to handle a large number of connections which receive a large amount of data. I have in incoming buffer of around 1/2MB to be read at a time using a NetworkStream wrapped around the socket. It is my understanding that a call to NetworkStream.Read will read what is available up to the buffer size and not necessarily wait until it has enough data to fill the buffer, is this correct?
The reason I ask is because I am getting connections dropped from the server side and when I dump the TCP stream I see the TCP window size drop until it hits 0 at which point the connection is dropped. The only explanation I can think of for this is that the NetworkStream.Read is waiting too long for data and the buffer is filling up meaning no more data can be received. Does this sound correct or could there be something else causing this problem?
|
|
|
|
|
Hi,
I'm trying to write an application which monitor another application using WMI.
One of the parameter I need to monitor is CPU usage by the monitored application.
Just for the test - The tested process is devenv.exe(i.e Visual studio).
When running the application and printing to the outout window I see that the process CPU usage is 0%(while the task manager shows 20-30%).
Note that other parameters are OK(for example Virtual memory , Thread count etc.).
This is my code to get all parameters related to devenv.exe:
private void MonitoringTimer_Tick(object sender, EventArgs e)
{
ObjectQuery winQuery = new ObjectQuery("SELECT * FROM Win32_PerfFormattedData_PerfProc_Process WHERE Name = 'devenv'");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(winQuery);
foreach (ManagementObject item in searcher.Get())
{
string s = "";
foreach (PropertyData PC in item.Properties)
{
if (PC.Value != null)
{
s = PC.Name + " : " + PC.Value.ToString();
}
else
{
s = PC.Name + " : NULL";
}
}
s = "******************************************************";
}
}
Can anyone help me solve this problem?
With best regards,
Eli
|
|
|
|
|
I've found that when using WMI you need to use NextValue() as opposed to Value.
Try that and see if it works.
|
|
|
|