|
thanks for your comment;
I need it through a program ..
what I mean here is currently running application but not this application;
|
|
|
|
|
Well, an application is just that - a process. If you mean you need the processes that Task Managers displays in the Applications tab - another hint - that's a process that has a window , and if it has a window it should have a window handle .
Read about the Process class on MSDN, see what kind of properties and methods it has - the answer is all there (and here actually), so it's up to you to do the rest.
2A
|
|
|
|
|
Hi
I'm experimenting with SQLite. The program complies and runs fine, except I can't see the actual stored ID's in my file1.db. Am I looking in the wrong place or doing something wrong here? I would appreciate any feedback. I basically store random text from texbox into file1.db
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SQLite;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private SQLiteConnection sqlcon;
private SQLiteCommand sqlcmd;
private SQLiteDataAdapter dataBase;
private DataSet dataSet = new DataSet();
private DataTable dataTable = new DataTable();
public Form1()
{
InitializeComponent();
createDataBase();
createDataTable();
}
private void createDataBase()
{
dataBase = new SQLiteDataAdapter();
}
private void createDataTable()
{
dataTable = new DataTable();
}
private void ExecuteQuery(string txtQuery)
{
using (SQLiteConnection sqlcon = new SQLiteConnection("Data Source=file1.db;Version=3;New=False;Compress=True;"))
{
using (SQLiteCommand sqlcmd = sqlcon.CreateCommand())
{
sqlcon.Open();
sqlcmd.CommandText = "create table records ( ID varchar(255))";
sqlcmd.CommandText = txtQuery;
sqlcmd.ExecuteNonQuery();
}
}
}
private void button1_Click(object sender, EventArgs e)
{
string txtQuery = "INSERT INTO RECORDS (ID) VALUES ('" + textBox1.Text + "')";
ExecuteQuery(txtQuery);
}
}
}
Thanks a lot
|
|
|
|
|
Are you looking at the correct database? You didn't specify a path, so it'll take the database that's in it's startup-path (probably the debug-folder of your app).
How are you "viewing" the data?
Bastard Programmer from Hell
|
|
|
|
|
Hi hope someone can help me with a bit of coding please.
I have on one form a text box in which a player should type their name as player 1, and on the 2nd form have that person's name show up in another text box.
Getting desparate here!
|
|
|
|
|
Hint do a search using passing data from 1 form to another , either in the forum or in the articles and you will find many answers to this question.
You might also try Google or any of the search engines.
I suggest you get a book on basic winforms programming and work through it. Learning from forum post is going to be very difficult!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Exactly how you do it depends on how your whole system works, but the first thing to do is to create a property in the Player Name form - call it PlayerName - and have it retrieve the value of the text box.
Now, either you need to use ShowDialog to display the PlayerName form in which case you retrieve the property immediately after showing the form (as ShowDialog stops execution until the form is closed). This is much like the way you do an OpenFileDialog:
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
string lines = File.ReadAllLines(ofd.FileName);
...
The other way to do it is to create an event in the PlayerName form which the main form handles. When the event is signalled by the PlayerName form, the main form reads the property and acts on it immediately. This is similar to the way a search box works: when you type a character in the box, it immediately affects a list elsewhere.
Other than that, I can only echo Mycroft: Get a book, and work your way through it, doing all the exercises. Learning by random questions is a bad idea, it means you miss so much basic information and principles which makes it hard to work out what is going on later. You wouldn't learn to drive by jumping straight into a F1 race, would you?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
You just have to change the modifier of textedit "Modifier = Public", then you can access Text property from the other form.
|
|
|
|
|
when I build my project it's goes well and run correctly but when I run it once more ,I get This error
Warning 1 The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again. 0 0
Can anybody help me with this I Redesign My project two times but it's not helping
|
|
|
|
|
Probably you've added another class to the Form1.cs file above the Form1 class declaration.
Either move the other class to a separate cs file (better for readability) or move the Form1 class as topmost in the file. Then refresh the designer and everything should be back to normal.
2A
|
|
|
|
|
thanks a lot ,
I've done what you recommend,it Worked
|
|
|
|
|
Hi All,
Odd question my PC (once I had rebuilt it after an evil spyware attack) now causes the system sounder to bleep every time a button is clicked on the form, this happens only with this program so I am suspecting an option has been selected in the compile options as when the installer is test run it does the bleeping thing again, why, I have never seen this before, what have I done??
Glenn
---------------------------------
Well I have gone into settings and disabled the Beep, that seems to have stopped it from bleeping but I would like to know if that is the only way of doing it! (it seems to me that you could be hiding a problem not solving it)
|
|
|
|
|
glennPattonWork wrote: rebuilt it after an evil spyware attack
Had you installed all necessary software/libraries/framework need to run that program ?
|
|
|
|
|
I think so, this rebuild has had to be rushed as a customer arrived for a demo of other stuff that wasn't complete so "Glenn can show you...". Vis Studio works fine, Outlook I have some mail from, Exchange Servers? I was thinking maybe in my rush to install yesterday I had chosen an option such as "Annoy User, Surrounding People" but disabling the beep in task manager has done the trick, making me nervous!
Glenn
|
|
|
|
|
|
|
i need to create pdf files to word format using C# and i want it to be done only wusing c# and no 3rd party apps/controls, is it possible to do this? if yes how?
by the way i added the refferance of MS Office Object 2012, but it seems i have to have a 3rd party app along with it...
|
|
|
|
|
If you dont want to use any 3rd party like iTextSharp.
Then create your own library is only option left.
Or someone here knows a way may shed a light !!
|
|
|
|
|
If you don't want to use any 3rd party functionality beyond what's available for you in the .NET framework, you are going to have to write code that will translate the .PDF file format. This is far from easy to do, and will require you to spend a lot of time writing code that others have already written and tested.
If your requirement is just that you don't want to use a paid component, I would recommend iTextSharp[^]. It's free, and allows you to read PDFs (well, that's slightly incorrect - you can't directly read PDF data and assume it's correct because a PDF is just a canvas that has text and graphics placed on it, so it has no real structure to it).
|
|
|
|
|
If you want to access PDF data without recourse to a third-party library then you need to start at the Adobe Development Centre[^], and learn how to use their tools. Or, you can download the PDF specification document and figure out how to do it directly with your own code. This may be easy or difficult depending on your skill level.
|
|
|
|
|
I have the following code in a C# 2010 application that uses linq to sql when connecting to a sql server 2008 r2 database.
var attplan = from p in attDataContext.At_Pln
where p.At_id.Equals((int)Session["AttD"])
select p;
attDataContext.At_Pln.DeleteOnSubmit(attplan.FirstOrDefault());
var att = from c in attDataContext.At
where c.At_id.Equals((int)Session["AttD"])
select c;
attDataContext.At.DeleteOnSubmit(att.First());
attDataContext.SubmitChanges();
My problem is the following line of code:
attDataContext.At_Pln.DeleteOnSubmit(attplan.FirstOrDefault());
The At_Plan table can contain 1 to 500 rows that are related to the At table.
I want to use some other statement besides FirstOrDefault() since this only deletes one row in the attplan table. However, the application will not let me try another commands without obtaining a compile error.
Thus can tell me what other linq statement that I can use that will let me delete all the records in the
attplan table?
|
|
|
|
|
DeleteOnSubmit is designed to work with a single entity. If you want to use this method, you simply iterate over att and call DeleteOnSubmit for each element.
foreach (var item in att)
{
attDataContext.At.DeleteOnSubmit(item);
}
attDataContext.SubmitChanges(); As you can imagine, this will not be the most efficient operation as it will result in multiple delete statements being made when you submit the changes.
So, there must be a way to delete more than one element. Well, there is, and it's called DeleteAllOnSubmit . It looks like this:
attDataContext.At.DeleteAllOnSubmit(att.ToList());
attDataContext.SubmitChanges();
|
|
|
|
|
I have an application wherein I have H.264 frames from an RTSP stream stored in a proprietary database. I need to be able to present a frame to the H.264 decoder (frames in sequence, of course) and get back the decoded frame (bitmap, whatever) output. I cannot use the traditional DirectShow streams because I don't have a stream. Is there any codec can be used in this manner? Later I will need to go the other way as well (given bitmaps or other format images, create an H.264 stream). Any help you can give would be greatly appreciated.
|
|
|
|
|
I have this string:
Dev: 0 Model: TOSHIBA MK3265GSX Serial: 20FDF20WS FW: GJ002H STW: 0 MaxLBA: 625142447 FDESUPPORTED: 0 PREBOOT: 0 DRIVETRUSTENABLED: 0 DRIVETRUSTSUPPORTED: 0 w128: 41 FULLFW: GJ002H SERVOFW: SDLSUPPORTED: 1 PLATFORM: 0 SAFE: 1 DSTTIMEOUT: 103 ISBOOTORSYSTEM: 1
I need to parse it into Key/Value pairs. I thought of RegEx, but I'm not sure how to code that.
Any suggestions?
If it's not broken, fix it until it is
|
|
|
|
|
Kevin Marois wrote: RegEx
How about (?:(?'Key'\S+): (?'Value'.*?)) with the RightToLeft option.
And, of course, we have a Regex forum.
|
|
|
|