|
Well if you getting the information from a database then you could simply add the strings "No" and "Yes" to the comobobox and then use the selected index property to select the correct string. For example if you're reading in the data from the database and the value you get is 0 then that would set the comobobox to index 0 (or the string "No")
- monrobot13
|
|
|
|
|
Sorry, I dont want to sound stupid, but I am, as I dont really understand how thats done. I can understand setting the selected index, but how would you tell the control to use Yes and No, and to bind those respective values to 1 and 0.
|
|
|
|
|
You simply do
this.comboBox1.Items.AddRange(new string[] {"No", "Yes"});
Now No has an index of 0, and Yes has an index of 1. When you read the data, simply
this.comboBox1.SelectedIndex = (int)myDataRow["MyBooleanColumn"];
bool value = (bool)this.comboBox1.SelectedIndex;
There is no binding in this situation.
To actually data-bind this, you're going to have to set ComboBox.ValueMember to the column in your data source or use the BindingContext to do such manually.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
My subject pretty much sums it up...how do you do it? How can you read and write to an MS Access table without using a DataSet object in your C# program. I have my reasons for not wanting to use one, and I would be happy to give them if anyone wants to know. But I really would like to know how to do this, if it is possible. Thanks.
|
|
|
|
|
WhatupE wrote:
I have my reasons for not wanting to use one, and I would be happy to give them if anyone wants to know. But I really would like to know how to do this, if it is possible.
Why exactly?
-Nick Parker
|
|
|
|
|
um, alright. because a DataSet kills your memory. If you have 7000+ records, possibly with pictures, there is no way a normal system can hold it. now, can anyone tell me how i can read/write to a MS database w/o using a DataSet. Thanks.
|
|
|
|
|
WhatupE wrote:
um, alright. because a DataSet kills your memory.
Not exactly.
WhatupE wrote:
If you have 7000+ records, possibly with pictures, there is no way a normal system can hold it.
I think you might want to consider refactoring your solution.
-Nick Parker
|
|
|
|
|
Look into Command and DataReader. It is a forward only reader. You can use standard SQL staements to update records via the Command.
Rocky Moore <><
|
|
|
|
|
I create a script to upload data into local server from other remote server.
Follow is my step.
1) step ,I link server
USE master
GO
EXEC sp_addlinkedserver
'MyOtherServer',
'',
'SQLOLEDB',
NULL,
'cebas',
'DRIVER={SQL Server};SERVER=MyOtherServer;UID=cdc;PWD=cdc;'
GO
2)step I get data from MyTable
select * from [MyOtherServer].[MyDatabase]..MyTable
Result:
Server Msg disp "Login failed for user 'sa' when I exec .
|
|
|
|
|
You might take a look at sp_addlinkedsrvlogin.
Rocky Moore <><
|
|
|
|
|
hi there!,
how can i change the focus so the input goes just to the panel.
for example in my program when i press enter or space one of the buttons on the toolbar works "cose in my program i use left and right keys and then enter!"
my input goes to mainform and not to panel wich on mainform
is there anyway just to disable input to toolBar.
i think its hard to understand my question
good luck.
|
|
|
|
|
i couldnt follow most of your question, but maybe this will help..
you should set focus to the control (textbox, etc.) that you want to have the initial focus..
create an OnLoad() handler for your mainform, and after the panel is displayed call:
this.myPanel.Focus();
or in your OnLoad() of the panel call
this.myTextBox.Focus();
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
MSDN help says you can use a UNC path for any methods
that accept a path, and I'm wondering if I can also
substitute an IP address for the UNC....???
Example:
Using System.IO.File.Move()
File.Move("\\\\MyServer\\share\\dir\\myfile.txt",
"\\\\YourServer\\share\\dir\\myfile.txt");
Should I also be able to use IP address like this?:
File.Move("http://192.168.1.1\\share\\dir\\myfile.txt",
"http://192.166.1.3\\share\\dir\\myfile.txt");
thanks for your input...
vince
|
|
|
|
|
On the network you shouldn't have to include the "http://" portion, but you can use the IP address of the server, usually.
-Nick Parker
|
|
|
|
|
thanks for the reply....
so I could do something like:
"\\\\192.168.1.1\\myshare\\dir\file.txt" ???
thanks for your input..
|
|
|
|
|
vlusardi wrote:
"\\\\192.168.1.1\\myshare\\dir\file.txt" ???
Yes, but you would only use two backwards slashes before the I.P. Address.
-Nick Parker
|
|
|
|
|
Nick,
thanks for the clarification... I'll be trying it out soon...
|
|
|
|
|
Ummm... if this is c++ or c# (non-literal string so things need to be escaped) you would need the double slashes, hence four slashes at the beginning...
Sorry, I being nit-picky....
-Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Well, with C# you could use a verbatim string with an @ in front of it and you would only need two backwards slashes.
-Nick Parker
|
|
|
|
|
How can I insert a row into a datagrid control that is bounded to a datatable? For clarification, by insert, I mean creating an empty row in the middle of the displayed filled-up rows. Having searched all the websites and entire MDSN library, I would greatly appreciate any tips on this. Thanks!
|
|
|
|
|
Set a handler for the ItemCreated or ItemDataBound and insert the row you want.
|
|
|
|
|
Ok I have a simple function used to resize and create thumbnails. I build the file in vs.net, CreateThumb.cs. Now how do I go about calling that function from an asp page?
I suppose I need to register the DLL etc...so I can call the function in my asp page? Need the syntax for that.
Call CreateThumb(param)
Please help!
Thanks,
Jordan
|
|
|
|
|
jrmcdona wrote:
I suppose I need to register the DLL etc...so I can call the function in my asp page? Need the syntax for that.
It doesn't really work like that. To get a .NET assembly .dll to load in a regular ASP page is a little difficult (though it can be done, check my article Creating a RCW for COM enabled non .NET applications[^] ). Otherwise if you are creating an ASP.NET page, you can simply create an instance of your class and start using it.
-Nick Parker
|
|
|
|
|
Also, the assembly either has to be dropped into the ASP.NET Web Application's private path (usually bin) or installed into the GAC (use gacutil -i <assemblyName> or drag it into \windows\assembly).
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
Hello Gurus,
Can anyone give me some good sources on this topic?
Thanks so much
Khang Nguyen
|
|
|
|