|
Hai,
Sorry for delay. went for lunch
Piece of code
private RibbonStyle.RibbonButton rbtnOpen;
private System.Windows.Forms.DataGridView datagrid1;
private System.Windows.Forms.DataGridViewTextBoxColumn txtSlNo;
private System.Windows.Forms.DataGridViewTextBoxColumn txtEntities;
private System.Windows.Forms.DataGridViewComboBoxColumn cmbType;
private System.Windows.Forms.DataGridViewComboBoxColumn cmbSubType;
txtSlno : Auto generation
txtEntity : user data
cmbType : Combobox data(loaded programmatically)
cmbSubType : Combobox data(loaded programmatically)
I want to load the data from the XML file(explained below) to the datagrid while openning XML file.
<NewDataSet><br />
<EntityTable><br />
<SlNo>1</SlNo><br />
<Entity>X</Entity><br />
<Type>Data</Type><br />
<SubType>EIF</SubType><br />
</EntityTable><br />
<EntityTable><br />
<SlNo>2</SlNo><br />
<Entity>Y</Entity><br />
<Type>Data</Type><br />
<SubType>ELF</SubType><br />
</EntityTable><br />
<EntityTable><br />
<SlNo>3</SlNo><br />
<Entity>Z</Entity><br />
<Type>Transaction</Type><br />
<SubType>EI</SubType><br />
</EntityTable><br />
</NewDataSet>
Regards,
KP
|
|
|
|
|
i want to move the form at run time by holding it from any area of the from . not only by holding it from the title bar , any idea?
|
|
|
|
|
You will need to subscribe to mousedown, mousemove and mouseup events of the form. Then adjust location form's position accordingly.
|
|
|
|
|
The code below should help you
private bool IsPickedUp = false;
private void pnlTop_MouseDown(object sender, MouseEventArgs e)
{
try
{
if (e.Button == MouseButtons.Left)
{
this.xPos = e.X;
this.yPos = e.Y;
this.IsPickedUp = true;
}
}
catch (Exception ex)
{
}
}
private void pnlTop_MouseMove(object sender, MouseEventArgs e)
{
try
{
Screen[] screens = Screen.AllScreens;
int width = screens[0].WorkingArea.Width;
int height = screens[0].WorkingArea.Height;
if (this.IsPickedUp)
{
Point temp = new Point(0, 0);
if (((this.Location.X + (e.X - this.xPos)) > 0) && (this.Location.X < (width - this.Width)))
{
temp.X = this.Location.X + (e.X - this.xPos);
}
else
{
if (e.X > this.xPos)
{
temp.X = (width - this.Width);
}
else if ((this.Location.X + (e.X - this.xPos)) > 0)
{
temp.X = this.Location.X + (e.X - this.xPos);
}
}
if ((this.Location.Y + (e.Y - this.yPos) > 0) && (this.Location.Y + (e.Y - this.yPos) < (height - this.Height)))
{
temp.Y = this.Location.Y + (e.Y - this.yPos);
}
else
{
if (e.Y > this.yPos)
{
temp.Y = (height - this.Height);
}
else if ((this.Location.Y + (e.Y - this.yPos)) > 0)
{
temp.Y = this.Location.Y + (e.Y - this.yPos);
}
}
this.Location = temp;
}
}
catch (Exception ex)
{
}
}
private void pnlTop_MouseUp(object sender, MouseEventArgs e)
{
try
{
if (e.Button == MouseButtons.Left)
{
this.IsPickedUp = false;
}
}
catch (Exception ex)
{
}
}
Please note that i am using panel here. You can use any control and register above events from them.
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
thanx, but could you please explaine me what is meant by all screens property, in the documentation it says ,takes all displays in the screen..
|
|
|
|
|
That's a non-standard interface. I recommend that you do not do it.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello all,
Am planning to use Logging and Instrumentation Application Block to instrument our product. Any bad experiences?
Thanks.
|
|
|
|
|
They are quite good. Use them freely
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
Hi everybody,Can any one Help me how to create Thumbnails using C#.net. I am using VS2005.I have searched but
|
|
|
|
|
Look at the System.Drawing.Image.GetThumbnailImage method.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You can use GetThumbnailImage() to get a thumbnail. Most of the time this will give poor quality images. GetThumbnailImage() returns the embedded thumbnail from the image and re size to the specified size.
You can get good quality thumbnails by using Bitmap and Graphics classes. Try the following steps
1 - Create a Bitmap instance with the required width and height.
2 - Load the original image to a Graphics instance (Graphics.FromImage()).
3 - Use Graphics.DrawImage() to draw the image to bitmap.
bitmap instance will have the thumbnail image.
|
|
|
|
|
N a v a n e e t h wrote: 2 - Load the original image to a Graphics instance (Graphics.FromImage()).
That should rather be:
2 - Get a Graphics instance for drawing on the newly created Bitmap (Graphics.FromImage).
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: 2 - Get a Graphics instance for drawing on the newly created Bitmap (Graphics.FromImage).
Yeah. That is more clear.
|
|
|
|
|
Hi guys, msndn says that "The WebBrowser control cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code. " http://msdn.microsoft.com/en-us/library/8skskf63.aspx[^]">
Does it mean that I cannot instiante webbrowser control as shown below.
public partial class lralHTMLEditor : UserControl
{
public lralHTMLEditor()
{
WebBrowser webbrowser1 = new WebBrowser();
}
}
|
|
|
|
|
Partially trusted code does nothing have to do with partial classes, apart from the word "partial". So you can safely use a partial class here.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Read up on Code Access Security and that'll make much more sense. For example, try running your app from a local hard drive and it'll work. Try running it from a network source, i.e.: mapped network drive, and you'll get security exceptions. Network sources for managed code, by default, are not trusted sources, so they run inside a heavily restricted sandbox.
|
|
|
|
|
Hi everybody!
I'm doing my project and I'm getting this message with just one of the .txt files that I create before.
I made a .dll from a C++ project and it works perfectly. The objective of the DLL is to create three images and three .txt files, after it finishes I call the images, which is working perfectly, and then I call the .txt files. Two of them open perfect and they show me the respective data but when I do click on a button to call the third .txt to show me the data, on the Debug mode VS2005 tells me: "The process cannot access the file TXT because it is being used by another process"
I don't know if it is maybe because the DLL is still making the txt file or something like that, but I haven't found the solution to my issue.
Here is a part of my code that is working with the other two files but it isn't with the last one:
int columnas = 0;
string puntoycoma, array3 = "";
string[] lines = System.IO.File.ReadAllLines(VariablesGlobales.path1 + "results\\correspondencias3.txt");
puntoycoma = lines[0];
int filas = lines.Length;
The part that is in black is where I read the .txt file.
I hope you can help me, I'm getting desperated!!
Thanks a lot for your attention, if you need more information about my code, I'm gonna be looking my mail all the time in case i receive a response from you.
|
|
|
|
|
Did you forget to call Close() on the file stream in the
code that creates the file?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well, I'm working with a another guy on my project, he is the one who knows how to work with C++. But while I contact him I can show you what he did:
First he creates the file and a pointer to the file or namefile:
Cmatrix correspondencias1;
correspondencias1.crea_matriz(width, height, 4);
FILE *streamp = fopen("results/correspondencias1.txt", "w");
Then he makes this to fill the file with the matrix columns and rows.
for (y= 0; y<H ; y++)
{
int *current = &m_disparity.Pixel(0, y, 0);
for (x = 0; x < W; x++)
{
correspondencias3.asignar_filas(x,y,current[x]);
if (x==W-1)
fprintf(streamt,"%d,%d %d,%d;\n",correspondencias3.matrix[x][y][0],correspondencias3.matrix[x][y][1],correspondencias3.matrix[x][y][2],correspondencias3.matrix[x][y][3]);
else
fprintf(streamt,"%d,%d %d,%d; ",correspondencias3.matrix[x][y][0],correspondencias3.matrix[x][y][1],correspondencias3.matrix[x][y][2],correspondencias3.matrix[x][y][3]);
}
}
fclose(streamt);
Well I saw the he used the fclose, I guess that this is what you meant, isn't it? streamt is a pointer, so it means that it is closing the file or not?
If you see that something is missing, please tell me and I tell him. I really appreciate your attention. Thanks a lot for your help.
|
|
|
|
|
That's what I meant, thanks.
I see
FILE *streamp = fopen(
and
fclose(streamt );
Is that just a typo?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oh, I'm sorry, I copied another part of the algorithm that creates one of the files that are working.
this is the parte where he declarates the streamt:
Cmatrix correspondencias3;
correspondencias3.crea_matriz(W,H,4);
FILE *streamt = fopen("results/correspondencias3.txt", "w");
and this is the part that it uses to create the .txt:
for (y= 0; y<H ; y++)
{
int *current = &m_disparity.Pixel(0, y, 0);
for (x = 0; x < W; x++)
{
correspondencias3.asignar_filas(x,y,current[x]);
if (x==W-1)
fprintf(streamt,"%d,%d %d,%d;\n",correspondencias3.matrix[x][y][0],correspondencias3.matrix[x][y][1],correspondencias3.matrix[x][y][2],correspondencias3.matrix[x][y][3]);
else
fprintf(streamt,"%d,%d %d,%d; ",correspondencias3.matrix[x][y][0],correspondencias3.matrix[x][y][1],correspondencias3.matrix[x][y][2],correspondencias3.matrix[x][y][3]);
}
}
fclose(streamt);
the problem is with correspondencias3.txt, correspondencias1.txt and correspondencias2.txt are working perfect.
if this is not the problem, what could it be?
thanks again for your help! I really really appreciate it!
if you need more info, just tell me.
|
|
|
|
|
Some process is holding the file open.
The only thing I can think of is step through the code -
especially from the point the file is opened (fopen()) to
where it gets closed (fclose()).
Make sure there's no execution paths that bypass the fclose().
Also check the return value of fclose().
Make sure there's no typos since you're working with 3 similarly named
sets of objects.
Good luck
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well, I did it!
I didn't modify the file that was created by the C++ DLL. What I did was copying the file into another one.
In the C# I put this:
try
{
File.Copy(VariablesGlobales.path1 + "results\\correspondencias3.txt", VariablesGlobales.path1 + "results\\correspondencias4.txt");
}
catch
{
MessageBox.Show("No se pudo leer archivo de texto, favor haga click en Aceptar y espere un momento", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
string[] lines = System.IO.File.ReadAllLines(VariablesGlobales.path1 + "results\\correspondencias4.txt");
I did a new one, a new .txt. That new one was the one that I read and copy to the new array!
Thanks a lot for your help again!
|
|
|
|
|
Thanks,but as per my requirement,without copying the file,i have to access the file.Any solution?please...
Regards,
Kiruthika
|
|
|
|
|
From my experience, the static methods of the "File" class are very slow compared to streams. Maybe 100 times slower. If you have concurrent access to a file it is best to make the reads and writes as short as possible.
I recommend replacing File.ReadAllLines with:
using (StreamReader sr = new StreamReader(...))
{
lines = sr.ReadToEnd();
}
Keyboard not found. Press F1 to continue.
|
|
|
|
|