|
|
why not?
TcpListener is server socket. after u start it
Listener.Start();
you can accept connection from
Socket socket=Listener.Accept();
and you can know from socket as i mentioned above who you are connecting with.
marcoryos
|
|
|
|
|
hi all
Miss With The Best And Die Like The Rest
|
|
|
|
|
How can I create a namespace and add it to my project so that i can reference it in my program.
Nana
|
|
|
|
|
Uhhh...try using namespace ?? If you look at any project that you create, you'll see something like this:
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace MyProjectNamespace
{
public class Form1 : Form
{
...
}
}
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello All,
I have an SQL query from a 10 table join. Around 30 fields from the join are displayed on a form and I want to navigate thru them. To achieve this, I have created a VIEW and filling the dataset with this VIEW. But MoveNext and MovePrevious are not working. I am getting the error "Cannot create a child list for the field BrowseShipping" where BrowseShipping is my VIEW that I created.
Is this error something to do with Data Binding?
Is it required to bind all the 30 fields I am displaying on the form for navigation?
If I fill a DataSet with a VIEW...Will this work...?
Please someone help me.
Thanks a billion in advance
Looney
|
|
|
|
|
A view is the same as any other select once it's come back from your database. You don't have to bind all, or even any of your fields for it to work. How do your movenext/moveprevious work ? Are you paging in the database, or in the code ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I tried to use Binding Context in the code to navigate and it doesnt work at all.
Do you have any better idea.
Thanks a lot
Looney
|
|
|
|
|
You've lost me completely here. A google for BindingContext in C# brought up the WinFX docs. Could you please explain exactly what you're doing - posting some code would be even better.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am creating a View(BrowseShip) and filling it in a dataset.
string sSQL = "Create VIEW BrowseShip AS SELECT A.CUST_CustomerICA, A.CUST_CustomerName..."
ds1 = new DataSet();
da1 = new SqlDataAdapter(sSQL, con);
da1.Fill(ds1, "BrowseShip");
And in MovePrevious click of button I am trying to do the below which actually throws the error...
this.BindingContext[this.ds1,"BrowseShip"].Position =
this.BindingContext[this.ds1, "BrowseShip"].Position - 1;
this.da1.Update(this.ds1);
I am not setting current position any where. I dont know anything abt navigation in .NET. In VB6 it was very simple...
Thanks in advance
Looney
|
|
|
|
|
> string sSQL = "Create VIEW BrowseShip AS
> SELECT A.CUST_CustomerICA, A.CUST_CustomerName..."
This statement is simply creating a view in the SQL Server database, which then you can query like a single table. You would create the view only once (for instance with SQL Server Query Analyzer) and then define a SELECT statement to use with the adapter :
(only once
string sSQL1 = "Create VIEW BrowseShip AS SELECT A.CUST_CustomerICA AS C_ICA, ...";
string sSQL2 = "SELECT C_ICA, ... FROM BrowseShip WHERE... ORDER BY...";
SqlCommand cmd = new SqlCommand(sSQL2, cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
cn.Open(); // Connection Open
da.Fill(ds, "BrowseShip");
cn.Close();
===
Hope this helps, the pro's here might correct me if I'm wrong...
|
|
|
|
|
I tried to do the way you explained...still it doesnt work...
It says cannot create a childlist for the field BrowseShip. BrowseShip is the view I created.
Do I need to bind controls on form to resultset like what we used to do in VB6...
Thanks
Looney
|
|
|
|
|
|
lovelylooney wrote:
I am not setting current position any where.
Well, in actual fact, the data grid will do the paging for you, if you turn the paging on. Otherwise, I've never seen code like this, only SQL code that returns only the current page of data.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am not using the datagrid. I wanted to navigate on a form that has text boxes and combo boxes. Now I am doing something like below...
cboShipmentRegion.DataBindings.Clear();
cboShipmentRegion.DataBindings.Add("Text",ds2,"BrowseShip.RGN_RegionCode");
txtBillICA.DataBindings.Clear();
txtBillICA.DataBindings.Add("Text",ds2,"BrowseShip.AST_ICA");
Anyways thanks for all the help. You have helped me more than once Christian.
Also thanks to oleman.
I am sure now, whenever I have some issue, I can count on you.
Thanks a billion
|
|
|
|
|
OK - so what paging are you doing if there is no grid ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a class that uses generics to have a typesafe DataSource property. I want to pass an instance of this class to a form and have it display the datasource. The code looks something like this:
public class DataSource<ItemType> where ItemType : StatefulObjectBase
{
public ItemType DataSource
{
....
}
public void Show()
{
DisplayForm f = new DisplayForm(this);
}
}
The question is, how do I code the parameter on the forms constructor. Using DataSource<StatefulObjectBase> doesnt work, even though the compiler should know that whatever is in the object is convertible to that type. Even using object didnt work.
All I want to do from the form is access some methods from my generic object. I dont care what type they are.
Any help would be much appreciated.
EDIT: oops, fixing generics.. damn less than and great thans
--
Dave
|
|
|
|
|
There are couple problems with this.
1. You cannot have public ItemType DataSource property as DataSource is name of the class
2. C# does supports generic methods, but not generic constructors.
You can write your code like:
<code>
public interface StatefulObjectBase
{
}
public class DataSource<ItemType> where ItemType : StatefulObjectBase
{
public ItemType TheDataSource
{
get { return default(ItemType); }
}
public void Show()
{
DisplayForm f = new DisplayForm();
f.Show<ItemType>(this);
}
}
public class DisplayForm
{
public DisplayForm()
{
}
public void Show<ItemType>(DataSource<ItemType> source) where ItemType : StatefulObjectBase
{
}
}
</code>
|
|
|
|
|
i am very new to c# and ASP.NET but i want to load audio files during application startup and play when button clicked. i got worked out how to do in windows forms with FileOpenDialog but i do not want openFileDialog in ASP.NET!
Any one with tips, hints please help!
Thank you
|
|
|
|
|
Where do you want to load audio files from ? If from the server, then an open file dialog will not help anyhow. If from the client, I'm not sure that you can. You can replace an openfiledialgo with a hardcoded path, but the real issue is where are the sound files, on the client or the server ? If on the server, then they can be played, but I'm at a loss as to why you're worried about a file browser ( which can't see the server anyhow ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
right now, i have all files in local computer. Some under http://localhost: and audio files in c:\My Documents folder. I have created all web forms with button to play Audio file but in windows forms it is ok by using OpenFileDialog and playback. Let say, in web forms using c# how could i load audio files and play back using button with out using FileOpenDialog?
Thank you Christian
I appreciated any help!
Thank you
abudicha
|
|
|
|
|
OK - so you want a webpage to load files off the users local computer, not off the server, and play them ? Why ? How can you browse to the users files without using a file browse dialog ? What are you hoping to have happen here ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
right now, i want to know how can i load files when i just
run files from localhost as "http://localhost/webApp/default.aspx" to load audio files with out interaction with fileDialog?
I do not mind which folder will be? i can put under wwwroot or under IIS if necessary. But i need direction how to do it?
Thank Christian
I appreciated any helps
Adam Budicha
|
|
|
|
|
OK - so you're going to run them off the server. The but that I'm lost with is why you're talking about a file dialog. Do you want to allow the user to browse the music files ? A file dialog won't help here, the files are on the server.
Here[^] is an article on getting music files to play in a web page. ASP.NET has nothing to do with it, the browser needs to pass the file down in a format that the browser knows what to do with. I don't believe ASP.NET encapsulates that sort of behaviour in any classes, so you need to do it yourself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I've added to my form a status bar and 2 panels.
The status bar is on the bottom, while the first panel is on the left the second panel is on the right.
I want the first panel is of 50 pixel always.
The second panel became bigger if the user resize the window.
It should attached to the first panel but the right follow the right of the window...
I would the status bar do that to... but i've not success neighter with the second panel nor the status bar...
why?
|
|
|
|