|
how to direct from 1form to another form & when i try to connected to Database the following error msg displays
"username not found"
the code
str ="username=hasitha;password=randika;databasemike;server=suntwo"
hello
|
|
|
|
|
how to direct from 1form to another form & when i try to connected to Database the following error msg displays
"username not found"
i think you are open particular user detail from form1 and show this detail to another form (form2). you can make a procedure on form2 which take UserID as argument and then basis on this UserID you can write query.call this procedure from Form1 and at this moment if user exist then load form2 otherwise dont transter focus to form2
the code
str ="username=hasitha;password=randika;databasemike;server=suntwo"
what is this ? i think it is connectionstring. Please look at database argument.
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
1 - try giving your subject some meaning
2 - try explaining your self a little more. The code you posted means nothing, except that I now know how to hack into your DB. The error does not come from this line, so where does it come from ?
3 - it sounds to me like you're usng online help to work on the edge of your skillset. Try reading through some books, so you understand basics like how to work with more than one form
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 )
|
|
|
|
|
Error in your connectionstring statement, correct that, see this.
server=servername;database=DatabaseName;uid=UserName;pwd=Password.
Bhaskar Shetty
|
|
|
|
|
|
i am using vb .net 2005
is there a way to make datagridview readonly property become false when we bind a datagridview with datatable ??
|
|
|
|
|
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.
|
|
|
|