|
Hello,
Try this:
Uri myUrl = new Uri("http://localhost:99/test/TestHome.aspx");
string pagina = myUrl.Segments.Last();
att.
Ernesto Fazolo
modified 22-Jun-12 13:09pm.
|
|
|
|
|
How can i create a tool with an windows media player and a playback device choiser like this..
http://www.abload.de/img/unbenannt-290mk6.png
(this is from teamspeak 3)
I got already a media player in my program and can play tracks with it, but the sound come all the time over my headset. I want to set that my program sound goes over the speaker. Someone know how to make this release?
Thanks for your help and sorry for my english
modified 2-Jul-12 8:04am.
|
|
|
|
|
here is the problem which I come across with:
I want to get process name ,application name and it's window title name
with the code below
listView1.Columns.Add("CurrentProcess", 2000);
listView1.Columns.Add("CurrentProcessPID", 500);
listView1.Columns.Add("CurrentApplicationname", 2000);
listView1.Items.Insert(1,Process.GetCurrentProcess().ToString());
listView1.Items.Insert(2,Process.GetCurrentProcess().MainWindowTitle);
listView1.Items.Insert(3,Process.GetCurrentProcess().Id.ToString());
but when I run my code I get this result
system.diagnostics.process(currentApplication on ByPId.vshost) form1
I enter this code to run in a timer tick so I use other application in the middle of this running code but I just get the result above.
I would appreciate any commend
|
|
|
|
|
whenever your app does something, it IS the current process. Therefore, GetCurrentProcess() isn't going to help you getting information about other processes.
The Process class does hold what you need, however, be aware there are a number of system processes you are not allowed to get information about (You would get some kind of access violation when you try). An alternative route would be using WMI, probably with the exact same limitations.
|
|
|
|
|
thanks a lot;
I would like to write an application to run at the back ground( I mean do such thing except for itself);
do you recommend any thing?
|
|
|
|
|
I second what Luc said above.
Just as a hint, if you need information for the processes currently running on the local system, you could use the Process.GetProcesses static method.
But I have to ask... What's wrong with Windows Task Manager?
2A
|
|
|
|
|
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).
|
|
|
|