|
Hi,
I have a datagridview control that has the datasource attribute set to my binding source bndSrc . Two buttons with the below code are filling the datagrid successfully with the datatable data whenever clicked but the problem is I still get columns from the previous table that I just cant get rid of by clearing the binding source, the dataset or by refreshing the datagrid or resetting it's datasource!
Please help guys.
private void button1_Click(object sender, EventArgs e)
{
FistTableAdapter.Fill(dataSet1.Table1);
bndSrc.DataSource = dataSet1.Table1;
}
private void button2_Click(object sender, EventArgs e)
{
SecondTableAdapter.Fill(dataSet1.Table2);
bndSrc.DataSource = dataSet1.Table2;
}
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Aren't you filling the datagridview before binding it to the table you want?
I'm still pretty green, but I've done something like this and I bound the dataGridView to the desired tableBindingSource before issuing a fill statement and that worked fine for me.
dataGridView1.DataSource = tableBindingSource;
|
|
|
|
|
You should be able to just go dataGridViewControlName.Columns.Clear before you change your datasource
|
|
|
|
|
Thanks mate! I think it's working now but I still cant see any change!!
I know my problem though, it's just refreshing the datagrid which I still cant do it!!
I know my datatable is loaded using the binding navigator and seeing how much rows I have for each table when there's nothing but a dark gray background on my datagrid!!
Please tell me how to refresh this bloody control refresh() or even reassigning the datasource didnt help.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
|
|
hi
When i was run that code i cannot received the marker in particular position in web page.
But when i was save that map via the coding ,at that time i can able to see the marker in particular lat and long position only in image format .but in webpage(aspx) a cannot be received the marker's position ..
plz guide me
This is my code snippet
protected void Button2_Click()
{
double Lat_max = 48.11576;
double Long_max = 29.17936;
mapObj map = new mapObj("1.map");
layerObj layer = new layerObj(map);
layer.name = "School";
layer.type = MS_LAYER_TYPE.MS_LAYER_POINT;
layer.status = mapscript.MS_ON;
classObj clsobj = new classObj(layer);
styleObj styobj = new styleObj(clsobj);
styobj.symbol = map.getSymbolByName("marker");
pointObj poiobj = new pointObj(0,0, 0, 0);
poiobj.setXY(Lat_max, Long_max, 0);
lineObj line = new lineObj();
line.add(poiobj);
shapeObj shp = new shapeObj ((int) MS_SHAPE_TYPE.MS_SHAPE_POINT);
shp.add(line);
layer.addFeature(shp);
imageObj img = map.draw();
}
Thanks in advance
Raju
|
|
|
|
|
No, it's not a problem in C#, the problem is that you have not yet grasped the full difference between a windows application and a web application.
What you are trying to do is possible in a web application, but it's done in a completely different way. You can't create an image in a click event and put on the page, you have to create the image in a separate page and use the url of that page as source in an image tag on the page.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I am working with WindowsApplication template of VS.NET 2005....
I have designed the form which contains a button and a listbox control....
I want to display the contents of the XML file in the listbox....error is displayed if i try include listBox1.Items.Add()
If i give Console.Writeline()...where will the output be displayed....
I am using the following code to read from XML file...
namespace ReadXMLfromFile
{
class xmlpath
{
static void Main(string[] args)
{
XmlTextReader reader = new XmlTextReader ("books.xml");
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
Console.Write("<" + reader.Name);
Console.WriteLine(">");
break;
case XmlNodeType.Text:
Console.WriteLine (reader.Value);
break;
case XmlNodeType.EndElement:
Console.Write(" Console.WriteLine(">");
break;
}
}
Console.ReadLine();
}
}
}
|
|
|
|
|
use a richTextBox instead of listbox
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Any specific reason for choosing the listbox than multiline textbox,richtextbox or treeview to display contents of xml.
|
|
|
|
|
You have a typo/html conversion error here:
Console.Write(" Console.WriteLine(">");
|
|
|
|
|
Hi everybody,
We have to store a password that we use to access an encryption certificate in the configuration of our application (it is an automated process, so we cannot ask a user for a password). We have done this for many years, using our own enceryption / decryption algorithm. The decryption would be coded in the software itself and not in a dll, so that it would not be easily accesible to others. Since we are moving the software from C++ to C# however, the easy possibilities of reverse engineering, make it an easy task for outsiders to find the used algorithm and consequently to decrypt the password, which would then give them access to the certificates used.
Does anyone have an idea of a means of incorporating routines in a c# program that cannot be easily reverse engineered (of course, if one goes through the hassle of viewing the assembly, it would always be possible to find-out, but this is a such an effort that we feel we can take that risk)
Many thanks in advance,
William
|
|
|
|
|
Obfuscation? If it is for a company there is a lot of software that exists that can make it a lot harder to reverse.
|
|
|
|
|
Thanks a lot. I did not even know the word before, but google provides some very interesting links!
William
|
|
|
|
|
thats what i like to see. someone willing to do the research with the aid of just one word. Now if only others were willing to learn :P
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
If they key and process are stored in the same place the scheme is broken and will no hold up to any determined attack. You need a method to remove the key from the process, period. Without asking a user for a password the next best thing is the windows certificate store, after that physical token verification.
Unfortunately, it sounds like you are trying to protect your certificates from your users so asking them to have the keys to the kingdom is also not secure. If that is the case then the application should only contain the public key. As such the important piece, the private key, can be kept secure in your own location.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
The keys are stored in the certificate, which is in the windows certificate store. This means that they are separated from the process. However, in order to get access to the crtificate, a password is required. We are not trying to deny the users access to this certificate, but since the relevant process is running as an unattended process, there is no user to ask for the password. We therefore store this password in a separate file, but we want to avoid a readable password to be around somewhere on the system, so we encrypt this password, using an algorithm that does not require any further keys. However, we want to keep the decryption process as secret as we can, which is why the reverse-engineering possibility of c# is a bother.
|
|
|
|
|
Can you not just export the certificate's public key without a password? I thought only the private key needed the password?
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Just to throw this out there. You should look up the concept of "Security through Obscurity" and why its a bad idea. To put it simply...the problem with maintaining security through obscurity means your mechanism of security hasn't really been tested. Even if you use obfuscation techniques to maintain your obscurity, eventually someone is going to figure out how to get around it and that someone will put your security algorithms to the test. Given the nature of digital security and based on the wealth of knowledge provided by cryptoanalysts, using a mainstream, thouroughly tested security algorithm is more likely to give you better security than a home-grown solution that has never really, truely been tested. Good mainstream algorithms that have been vetted by the crytoanalyst community have been put through rigorous testing over many years, and are generally prooven to be secure against attack.
Just my two cents anyway.
|
|
|
|
|
Hi,
I'm using Application.Idle to do some background processing. The background processing updates a progress bar making it easy to tell if it's running or not.
I notice that if I launch a SaveFileDialog(), the background process is suspended which is exactly what I want to happen. However when I create my own modal dialog, the background process continues to when the ShowDialog() method is called.
Any ideas on why there's a difference between the two? Shouldn't all modal dialogs behave the same when it comes to event processing?
Thanks.
-- Greg
|
|
|
|
|
Hello,
I've noticed that when I'm running code, everything becomes devoted to running that program.
Most code I write doesn't need to do stuff all the time, just once in awhile it should do a particular operation and then become idle.
What's a quick way for me to make sure my programs aren't hogging up resources?
Thanks in advance,
Michael Fritzius
|
|
|
|
|
I would use an application like CLR Profiler if I were you. Check this to see where code is inefficient.
|
|
|
|
|
Hi,
it sounds like you have one or more empty loops, i.e. a loop testing some condition and when (not) met
just start the next iteration. Each of those is a good recipe for keeping one core busy. The easy way
out is to include a Thread.Sleep(100) in all such loops. The clean approach is to make things entirely
event-driven so you don't need polling loops at all.
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 Friday, June 10, 2011 11:25 PM
|
|
|
|
|
Hi,
I'm trying to make the images in a super slide show to automatically enlarge. Super because I want to control the images with a timer accuracy of 1 millisecond.
So I've got a timer event set up. That changes the image (according to a config file) every x ms.
When the image is shown I want the image to grow larger (including beyond the size of the screen) to create the effect of flying into the image.
I can't get it to work.
Here's the code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using Multimedia; //For the MM timer
using System.Windows.Forms;
namespace MyImage
{
public partial class Form1 : Form
{
public delegate void ScaleImageDelegate(); //public delegate void WriteDataDelegate(object sender, EventArgs eArgs);
Multimedia.Timer myTimer = new Multimedia.Timer(); //Define a new 1ms resolution timer
int TimeCounter, ImageCounter;
bool DoScale = false;
Bitmap[] myImage = new Bitmap[10];
string[] ImageName = new string[10];
int[] ImageStart = new int[10];
int[] ImageDuration = new int[10];
int TotalNumberofImages;
float Scaler = 1;
public Form1()
{
InitializeComponent();
myTimer.Mode = TimerMode.Periodic; //Make sure the timer keeps running after the set period
myTimer.Period = 10; //Set the period (when the Event is triggered) to x ms
myTimer.Resolution = 1; //Set the resolution of the timer to 1ms
this.myTimer.Tick += new System.EventHandler(this.myTimer_Tick); //Initialize the EventHandler
GetFiles(); //REad the images in an array for fast display
myTimer.Start(); //Start the timer and thus the Event Handler and do something
TimeCounter = 0; //Reset the timer counter
ImageCounter = 0;
}
void myTimer_Tick(object sender, System.EventArgs args)
{
TimeCounter += 1; //an other 10ms has elapsed
if (TimeCounter * 10 == ImageStart[ImageCounter])
{
pictureBox1.Image = myImage[ImageCounter];
ScaleImage();
}
if (TimeCounter * 10 == ImageStart[ImageCounter] + ImageDuration[ImageCounter])
{
pictureBox1.Image = myImage[4];
ImageCounter += 1;
DoScale = false;
if (ImageCounter > TotalNumberofImages)
{
Application.Exit();
}
}
if (DoScale)
{
ScaleImage();
}
}
void GetFiles()
{
TextReader tr = new StreamReader(@"c:\data\images.dat");
char[] seps = { ';' };
String line;
String[] values;
int i =0;
while ((line = tr.ReadLine()) != null)
{
values = line.Split(seps);
ImageName[i] = values[0];
ImageStart[i] = int.Parse(values[1]);
ImageDuration[i] = int.Parse(values[2]);
i++;
}
TotalNumberofImages = i - 1;
for (i = 0; i <= TotalNumberofImages; i++)
{
myImage[i] = new Bitmap(ImageName[i]);
}
// close the stream
tr.Close();
}
private void ScaleImage()
{
double myWidth, myHeight;
if (InvokeRequired)
{
BeginInvoke(new ScaleImageDelegate(ScaleImage));
return;
}
if (!DoScale)
{
Scaler = 1;
DoScale = true;
}
Scaler += 0.01f;
myWidth = Convert.ToDouble(pictureBox1.Width) * Convert.ToInt32(Scaler);
pictureBox1.Width = Convert.ToInt32(myWidth);
myHeight = Convert.ToDouble(pictureBox1.Height) * Convert.ToInt32(Scaler);
pictureBox1.Height = Convert.ToInt32(myHeight);
}
}
}
THX!
Marco
|
|
|
|