|
aphei wrote: a way to make datagridview readonly property become false
What wrong with this code? DataGrid1.ReadOnly = false;
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
that's nothing wrong with that script.
but i still can't edit the columns.
when i write "datagrid1.Columns.Item(0).ReadOnly = False"
it become error
how can i edit my datagrid when i bind it?? thank's
-- modified at 2:22 Tuesday 21st August, 2007
|
|
|
|
|
You should able to edit the columns after you bind it, you can't set datagrid's single column to read-only.
Check the Datagrid Read only property, It should be false.
Bhaskar Shetty
|
|
|
|
|
thanks Bhaskar Shetty. your answer is help me very much.
|
|
|
|
|
You can only change a bound DataGridView Cell's value if it's underlying Data Field is NOT Read Only.
Make sure that you are using a DataSource that can be updated.
Tom Garth
Developer
R. L. Nelson and Associates, Inc., Virginia
|
|
|
|
|
thanks Tom.. your answer is help me very much..
|
|
|
|
|
How I can bind the textbox and datacombo controls at rum time?
I am using treeview to show the products.
For example:-
when user click on any product from the treeview it should display the other fields in the textboxes and datacombo.
Can any body help me how to bind the textbox and other controls at run time?
Thanks in advance
Ejaz
|
|
|
|
|
bind is the wrong word. You handle the selected item changed event on the tree view, and then you write code to read the other information you require and shove it into the textboxes. runtime is the only time you can do this, or do you mean to define the rules as to what text goes where, at runtime ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
I have an a button on a form, the button has an image set at design time.
if certain conditions are met i would like to change the image on this button to a different image.
both images in question are loaded as an application resource and appear as an image in the resources (My.resources.).
I tried going the route of:
if "condition met" then
me.btnX.image = my.resources.image2
end if
this does not work!
any thoughts would be appreciated.
Thanks!
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)<br />
{<br />
pictureBox1.Image = WindowsApplication5.Properties.Resources.image2;<br />
}
I have tried with BMP image. It works fine.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
- The image is loaded into a button (not a picture box)
- I am also coding in VB.Net VS2005, so to access the image in resources i refrence it as follows:
My.Resources.ImageName
The reference you listed:
WindowsApplication5.Properties.Resources... is not in vs2005
Can any one help?
-- modified at 16:42 Tuesday 21st August, 2007
|
|
|
|
|
rnamro wrote: The reference you listed:
WindowsApplication5.Properties.Resources... is not in vs2005
I'm using VS 2005 and C# as language."WindowsApplication5" is the project name.
button1.BackgroundImage = WindowsApplication5.Properties.Resources.logo ;
Okay. I will give you the VB.NET 2005 code. Please try the following steps.
- Create the new VB.NET window application in Visual Studio 2005
In Solution Explorer ~
1. Go to My Project under project root.
2. Double click to open the properties.
3. Go to "Resources"
4. Click "Add Resource" and "Add existing file"
5. ("File Open" dialog will be opened) Select the picture.
6. then, Save
7. Go to button Click event. (Make button a lit bit larger to see the image.)
8. Write the code below
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Button1.BackgroundImage = My.Resources.Image1<br />
End Sub
9. Run the application
10. Click the button (Observe: the image will be shown on the button)
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
There is nothing wrong with your code. Try proving to yourself that "condition met" is actually True when it is tested, and that image2 is actually what you think that it is.
Tom Garth
Developer
R. L. Nelson and Associates, Inc., Virginia
|
|
|
|
|
Basically what I want to do is - subtract a time record from my system time and place that result into a dynamic column for each record. I'm definetly having problems with my loop and the loop syntax - help will be greatly appreciated.
With the code below I get an error system.InvalidCastException: Invalid cast from Int32 to DateTime.
at System.Int32.System.Iconvertible.TODateTime(IFormat Provide provider)
at System.Convert.ToDateTime(Object Value)
at System.Data.Common.dateTimeStorage.set(Int32 record, Object value)
at System.Data.dataColumn.set_Item(Int32 record, Object value) Couldnt stor <0> in requested_date Column. Expected type is DatTime.
When I change the for loop around a just a littile I will get the difference of time for just the first record...Thanks
Here is my code:
Public Sub frmLoad()
Dim i As Integer
Dim MyDataSet As New DataSet
Dim command1 As New SqlCommand("Select * FROM LateOrders_query_view order by reason", cnn1)
Dim SqlReader As SqlDataReader
Try
cnn1.Open()
'Debug.WriteLine(cnn1.ConnectionString)
Dim dt As New DataTable("LateOrders_query_view")
dgOrderReport.DataSource = dt
Dim DirAdapter As New SqlDataAdapter(command1)
DirAdapter.Fill(MyDataSet, "LateOrders_query_view")
dgOrderReport.DataSource = MyDataSet.Tables("LateOrders_query_view").DefaultView
Dim dc As DataColumn
dc = New DataColumn("Days Late") ', Type.GetType("System.double"))
MyDataSet.Tables(0).Columns.Add(dc)
dayslate()
Dim array As Array
Dim cntr As Integer
'Loop thru each record calculate time difference
For i = 0 To MyDataSet.Tables(0).Rows.Count - 1
MyDataSet.Tables(0).Rows(i).Item(3) = 0
'array(cntr) = MyDataSet.Tables(0).Rows(i).Item(3)
'Get Results place into Column "Days Late"
dc.Expression = DateDiff("d", dgOrderReport.Item(dgOrderReport.CurrentRowIndex, 3), System.DateTime.Today)
Next
Dim tblSetting As New DataGridTableStyle
tblSetting = New DataGridTableStyle
With dgOrderReport
'.SetDataBinding(MyDataSet, "LateOrders_query_view")
' .BackgroundColor = System.Drawing.Color.Lavender
' Set DataGrid Caption Background Color
.CaptionBackColor = System.Drawing.Color.SlateBlue
' Set DataGrid Caption Foreground Color
' .CaptionForeColor = System.Drawing.Color.LemonChiffon
' Set DataGrid Parent Rows Background Color
'.ParentRowsBackColor = System.Drawing.Color.Lavender
' Set DataGrid Parent Rows Foreground Color
' .ParentRowsForeColor = System.Drawing.Color.SlateBlue
.CaptionText = "Late Order Report"
.TableStyles.Clear()
End With
tblSetting.MappingName = MyDataSet.Tables(0).ToString()
dgOrderReport.TableStyles.Add(tblSetting)
settings()
Catch ex As Exception
MsgBox(ex.Message)
End Try
cnn1.Close()
End Sub
-- modified at 11:41 Tuesday 21st August, 2007
Thanks
|
|
|
|
|
Hey Everyone,
I'm working with vb.net/05. I am importing data from an excel file with a lot of different names. I want to have a list of all the different names without duplicates. I figured using the autofilter function would be the best bet. How would I go about taking the results of the autofilter and displaying them in a combo or list box. Some examples, or a better approach at the idea would be a great help and I would really appreciate it.
Thank you,
Mike
-When I was younger I could remeber anything, whether it happened or not
|
|
|
|
|
vb.net 2005
I have one textbox. I want to enter a string and run my addrecord sub when I press enter. Something ive never learned that Im sure is very simple. Someone give me some code, thank you guys/girls!!!
|
|
|
|
|
To teach your self start out with what is available to you. The keypress event has 2 arguments. The sender and the e. Well you know who the sender is...the text box. well what's e? inside the routine, press e and then the period. you get options of what's available to you. you'll see a property called 'keychar'. that is the character representation of what you pressed. well what are you looking for? the return key. so test for it.
Private Sub txt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt.KeyPress
if e.keychar = controlchars.cr then
'run any code you want...
end if
End Sub
|
|
|
|
|
It works, thank you for your help....
|
|
|
|
|
I am writing a program for someone and they wanted the strongest encryption method I could think of. I tried out a scheme but I have no way of knowing how strong it is.
Basically two passwords are entered and the file to be encrypted is selected. Let's assume the file is 1,024 bytes (1 KB). The software opens up the file and loads it into a byte array. Then it fills two different byte array with VS 2005 cryptographic random numbers. It XOR the data with the first random array and then XOR the result of the first XOR with the second random array. The first random array is encrypted with AES (Rijndael 512) with the first password. Then the second array is encrypted with Triple DES with the second password. Finally all three arrays are written to a file.
My question is what test can be preformed on such a file to tell if it is actually well encrypted? Statistical test? I know this seems like a little overboard but the person I'm doing this for did not want just encryption with AES or DES but wanted something beyond that and I was trying to aim for the strength obtained when one-time truely random pad data is used? Does this come close to it?
Does this method actually make the file more secure because it is relying on two seperate passwords and two sets of random data? Decrypting just one random pad will not decrypt the file and two different encryption algorithms are used at two seperate parts?
Comments and feedback are welcome.
|
|
|
|
|
Security through obscurity doesnt count. Basically this scheme is as strong as both of your encryption schemes (an attacker would have to break both). The one time pad aspect adds nothing. (Apart from tripling the size of your data).
Homebrew encryption is never really the answer. If you don't think either algorithm is strong enough for the task at hand (or is likely to be broken while the data should still be secret), then just take your data, encrypt that with method A, then the result with B.. etc.
You might also want to consider that an attacker would choose to go for the much easier "rubber hose cryptoanalysis" by convincing your friend to provide any passwords and keys, because thats going to be easier than breaking well-respected cryptographic algorithms.
|
|
|
|
|
Hi
In my application i am downloading mails from server.I am saving all
the mail information into database like to,from,cc,bcc,body.
While saving all information to database i am having one problem.
Suppose my mail body contain html table and message is written in
html table then when am saving mail body to database i am getting
all html tag like <htm> like this all the html tag are
also saved into database but i want to avoid html tag while saving
mail body to DB.How can i do this.Can anybody help me to solve this.
I am using pop3 protocol and indy socket liabery.
Thanks.
-- modified at 11:55 Monday 20th August, 2007
Rahul.
|
|
|
|
|
with the understanding that the format will be all messed up... take the body of email and loop through the text finding the next < if after the < is an html tag then look for the > and replace that with "". keep doing this until you are done.
|
|
|
|
|
i tried to use the winformclient project at this location
http://www.codeproject.com/dotnet/FTPWinFormClient.asp
& i used the code in vb.net 2003 but i get the below error
'System.Collections.Specialized.StringCollection' cannot be converted to 'Indy.Sockets.TIdStringsFCL'.
in
drawDirectoryContents() at
lFtp.List(ls, src, True)
where ls is a string collection object
i used CType to convert ls into 'Indy.Sockets.TIdStringsFCL
even then i get the same error.
Can anyone help me with this .Below is the code
Private Sub drawDirectoryContents()
statusBar1.Text = "Listing directory contents .."
lstDirectory.Items.Clear()
Dim ls As System.Collections.Specialized.StringCollection = New System.Collections.Specialized.StringCollection
Try
lFtp.List(ls, src, True) 'getting error at this line
Catch ex As Exception
statusBar1.Text = ex.Message
Return
End Try
Dim obj1 As Object
Dim file As String
For Each file In indychild
lstDirectory.Items.Add(obj1)
Next
For Each file In ls
lstDirectory.Items.Add(file)
Next
End Sub
|
|
|
|
|
padbindu wrote: i used CType to convert ls into 'Indy.Sockets.TIdStringsFCL
even then i get the same error.
I have no idea what a TidStringFCL is, but it's plainly not a string collection. You can't just magically cast stuff, it needs to define a conversion. Can you build an instance of the class you need in code, using your string collection ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi. I'm writing radio station scheduling software for my 3rd year project. I'm looking for something to use to store and display mp3/mp4 metadata along with the appropriae playing times for the various songs. The schedule needs to be saved and allow for scheduling in advance. It will cover the full day-to-day scheduling for the radio station. If anybody can give me any advice on what I could use and a possible starting approach I would really really appreciate it. Thanks
Mr Oizo
-- modified at 8:51 Tuesday 21st August, 2007
|
|
|
|