|
Hi, im trying to store multiple items from a listbox / checklistbox to a column in a database.. storing them is a breeze(i think)
but the tricky part is how do i retrieve them into
(1) textbox(es) or
(2) listbox. like below :
1. item1
2. item2
3. item3
4. item4 and so on..
instead of item1,item2,item3,item4.....and on..
do i have to use a loop or is there a better way to go about this..pls help..
CODER
|
|
|
|
|
Look for Control.DataBindings Property in MSDN. There is an example there too.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
You can also find many samples of data-binding in the .NET Framework SDK, .NET Samples - Windows Forms: Data Binding[^].
Data-binding allows you to take a data source (a DataSet is a common and rich source), assign that to a control's DataSource property (if it has one, like the DataGrid ), set a few other properties and that's it (in ASP.NET, it requires a call to a DataBind method). You can data-bind just about anything, though. The DataBindings property allows you to manually (not quite as easy as what I described above, but do-able) binding a control's properties to a data source. The .NET Framework provides data-binding "managers" for data sources and for properties (so you could binding two controls' properties together). See the documentation for the BindingManagerBase[^] class in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How would I go about creating a new window UI in VS.net for C#?
An article or something to point me in the right direction would be appreciated. If you need any more information about what I'm trying to accomplish, don't hesitate to ask.
|
|
|
|
|
authenticgeek wrote:
If you need any more information about what I'm trying to accomplish, don't hesitate to ask.
We're asking... What do mean by "create a new window UI"?
RageInTheMachine9532
|
|
|
|
|
Modifying the look of the windows.
The grey and gradient blue isn't aesthetically pleasing to me and I'd like to do more than just change the current Windows theme. Perhaps I'll change the location of the close, resize and minimize buttons as well and use different icons for those.
Is this something that can be done with .net and C#?
|
|
|
|
|
It could be done, but it is FAR from a trivial task. You'd be writing an entirely new Windows Shell.
You might want to look here[^] for some examples first, before you go down the road of rewriting Explorer.exe.
RageInTheMachine9532
|
|
|
|
|
I see what you're saying but what if I just want to change the appearance of the application I'm creating? The easiest example is iTunes for Windows. It looks pretty much like it does on OS X but on any windows machine.
Does this make things easier?
|
|
|
|
|
That simplifies things bit. Owner drawn forms...Hmmm...
I'd follow Heath's advice and go for overriding WndProc. I've never done an owner drawn form, so I don't know if the Framework Form class will let you do that.
Heath, got any insight?
RageInTheMachine9532
|
|
|
|
|
It's not something easily done in C# (or any .NET language) because the non-client areas of a Window are not exposed directly. All the controls (including forms) "simply" encapsulate the Windows Management and Common Control APIs. You can often change this behavior by overriding WndProc and handling notification messages (like WM_NCPAINT ) to change the behavior. Often times, you must P/Invoke a lot of native methods (like SendMessage ) and re-declare various necessary structs and consts. It can be done, but like the other post said, it's not trivial. Win32 programming experience will definitely be helpful. Learn first how to do it in C/C++ since you won't have to redeclare everything you need (since it's all defined in the headers you'd require). You should also consider using Managed C++ in mixed mode compilation because you can easily use the native APIs without having to P/Invoke them. This would produce an unverifiable assembly, though, but that's not a problem when running from the local machine.
Search CodeProject for examples of how to override WndProc . A common implementation is to override WndProc for the ListView (which enscapsulates the List-View common control) to provide various things that Windows Forms does not expose.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i think theres a namespace called Design for changing the controls in the design time, search for it if it could help
|
|
|
|
|
i m doing a HttpResponse to an url, every response is put in a thread, the problem is the variables i used in the AsyncResult, already i asigned an array of variables, i want to send the index of that variable to the thread, how can i do this?
|
|
|
|
|
You might want to post a code sample of what you doing. The description you gave is disjointed and is very difficult to picture what your doing.
RageInTheMachine9532
|
|
|
|
|
Here's the code i wrote
<br />
int i = 0;<br />
while(DataReader.Read())<br />
{<br />
url[i] = new String('u',1);<br />
<br />
DateIn[i] = new object();<br />
<br />
UserID[i] = DataReader.GetInt32(0);<br />
url[i] = DataReader.GetString(1);<br />
DateIn[i] = DateTime.Now;<br />
<br />
Req = (HttpWebRequest)WebRequest.Create(url[i]);<br />
<br />
<br />
<br />
CallBack = new AsyncCallback(AsCallBack);<br />
i++;<br />
Req.BeginGetResponse(CallBack,null);<br />
}<br />
and heres the call back function
<br />
private void AsCallBack(IAsyncResult ar)<br />
{<br />
try<br />
{<br />
DateOut = new String('S',1);<br />
Status = new String('T',1);<br />
Res = (HttpWebResponse)Req.EndGetResponse(ar);<br />
DateOut = ((TimeSpan)(DateTime.Now - (DateTime)DateIn[i])).ToString();<br />
Status = Res.StatusCode.ToString();<br />
}<br />
catch(HttpException er)<br />
{<br />
Status = er.GetHtmlErrorMessage();<br />
}<br />
catch(WebException er)<br />
{<br />
Status = er.Status.ToString();<br />
}<br />
catch(Exception er)<br />
{<br />
Status = er.Message;<br />
}<br />
thx for ur help
|
|
|
|
|
First, instead of threading these yourself, use the Begin* and End methods. You'll get an IAsyncResult implementation back. You could possibly use the AsyncState to set new data, but you must be careful because the thread might be done so it won't matter, or you may corrupt the data that the async thread is using. Typically, you give a thread everything it needs before it starts the the thread is responsible for querying a source for anything else it might need during execution (like a database, online resource, callback, etc.).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I created a Asp Web Application. I try to print my job with printdocument.
But I always failed.
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.PrinterSettings.PrinterName = "EPSON LP-8600F";
pd.Print();
......
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
......
}
My Program don't Normally Work.
Can who tell me is it why ?
Thanks.
|
|
|
|
|
Why don't you use javascript... window.print();
This doesn't give you server-side processing at print-time, but you can make that work by using a Button . Just have the click handler register the above javascript using the Page.RegisterClientScriptBlock(string, string) method.
I'm not sure exactly what you're trying to achieve, but I hope this works.
Michael Flanakin
Web Log
|
|
|
|
|
My program had worked.But there were not What i want to be result.
The Text's endcoding were wrong.
I try to much font,but this wrong still are exists.
|
|
|
|
|
What are you trying to print?
Michael Flanakin
Web Log
|
|
|
|
|
Are you trying to print on the server or the client? If you're trying to print on the server, then you must make sure that the user account under which ASP.NET runs (the local ASPNET user account by default) has the printer set up. You must also make sure that the user has rights to print to the printer. If you search this forum (click "Search comments" above), this has been covered in the past.
If you're trying to print on the client, this won't work. ASP.NET involves server-side execution, minimally using client-side javascript and elements/attributes to do its job. You can't execute code like this on the server and expect anything to happen on the client. In this case, the other post above this (the first reply you got) is the way to do it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks.
my Program had worked normally.
|
|
|
|
|
Hi,
Where can I get source code of a Forum Board that uses Access as the back-end database? I have looked through several, but can't find any that uses Access as the database.
Any links or ideas?
Thanks...
|
|
|
|
|
You might want to try the ASP.NET Forums source, found here[^]. It's backend is SQL server, but could be converted to work with an Access database. I don't know of any Forums board that uses Access simply because of capacity and performance issues.
RageInTheMachine9532
|
|
|
|
|
Converting the ASP.NET Forums from SQL Server to Access won't be as easy of a task as you make it sound. Unless it's changed since the last time I saw it, the forums use a lot of stored procedures, which would have to be moved to a data access layer. This conversion may not be that big of a deal, but don't expect it to be an easy task without looking into it first.
Michael Flanakin
Web Log
|
|
|
|
|
All I said is that it COULD be done. I didn't say anything about how easy/hard it would be, and I have seen the source for ASP.NET Forums.
Anyway, looking at the source of a few boards would also give him some ideas about what needs to be done to get his own Access database backend up and running. From looking at the design of existing databases, he could use them as models to design and build his own Access backend. Although, in my opinion, it would be much easier to just install and use the MSDE.
RageInTheMachine9532
|
|
|
|