|
it has nothing to do with date format. basically 2003-2004 is what users will enter and its like standard format. i just want to plot graph betwn actual vs estimated and with the year string.
hope i am not confusing you
|
|
|
|
|
|
frmlogin has txtusername.text and txtpassword.text. I would like to take the text that is put into the txtusername.text and send it over to form2 once I hide frmlogin and show form2. I have tried this and failed.
Public user as string
user = txtusername.text
This does not work when I try to put user into form2. So how would I go about this?
Thank You
-- modified at 18:26 Monday 6th March, 2006
|
|
|
|
|
Form1 contains:
-txtusername
-txtpass
Form2 contains:
-lblUser
-lblPass
When closeing form1...
Dim fr as new Form2
fr.lblUser.text=txtusername.text
fr.lblPass.text=txtusername.text
fr.showdialog
and on Form2 make that labels invisible... Thats all... :->
FeRtoll Software.net
--------------------
I fertoll@net.hr I
--------------------
|
|
|
|
|
The easy way is to create a public variable on Form2 and pass the txtusername.text to that variable
Insert on the top of the class of Form2
Public UserName as String
In the frmLogin:
Dim SecondForm as new form2
SecondForm.UserName=txtusername.text
SecondForm.show
me.hide
You can also use a property but...
Hope it helps
|
|
|
|
|
Hi
You can do this in many ways. I will suggest 2 ways.
1.
Create property on form2... (Say User) and set that property after initialize form2 class.
Set the property value to label on it in the form_load
Sample code written on VB 2005
Public Class Form2
'Use property for this
Public user As String
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Label1.Text = user
End Sub
End Class
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim f2 As Form2 = New Form2()
f2.user = Me.txtLogin.Text
f2.ShowDialog()
End Sub
End Class
2.
Create constructor in Form2 in order to pass string (Public sub New (user as string))
And pass textbox value then you initialize Form2.
Set the passed value to label on it in the form_load
No sample code .. (i didnot check this should be work)
Try those. Guaranteed to work well
Regards,
chandana
|
|
|
|
|
On form2 I have set Public username as String.
On frmlogin this is the code for the ok button when you type in the username and passwoed.
If txtpassword.text = frmlogin.tag Then
Dim secondforum As New Form2
secondform.username = txtusername.text
secondform.show
me.hide
Else
msgbox "Try Again"
End If
On form2 under Forum Load I have form2.caption = username
For some reason the username does not go over to form2. I tried to use F8 to see if the username was being seen in Public username as String but for some reason when in F8 mode it won't skip over to the second form code so I can hover over it with mouse and check.
*EDIT*
Ok I got it to work not sure what did it though. But aftering changing secondform.username = txtusername.text to secondform.username = me.txtusername.text it worked.
And on form2 useing me.caption = username.
Thank you for the help!
-- modified at 19:05 Monday 6th March, 2006
|
|
|
|
|
The best way to do this is store the username in a global variable in the login screen. This variable can be accessed throughout the application.
With Best Regards,
Mayur
-- modified at 23:22 Monday 6th March, 2006
|
|
|
|
|
I have two forms
- Form1
- Form2
On Form1 i have textbox and button
On Form2 i have listbox and button
----------------------------------
I need that if u click on form1 on button that the form2 shows up...
Now on form2 u select an one of 100 items...
U click on button "Insert" and the form2 closes.
The textbox gets the selected item text, buth in position where was the (Ibeam - the cursor i dont know how to explain the line "|" when u typeing.)
----------------------------------
I have tried in manny ways buth can't doo it...
For now i did it like this buth not working:
<code>
Dim sX As Integer
Dim lin As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
sX = TextBox1.SelectionStart
lin = TextBox1.Lines.GetValue(TextBox1.SelectionStart)
Dim f As New Form2
f.ShowDialog()
TextBox1.Select(sX, 0)
TextBox1.Lines(lin).Insert(sX, f.ListBox1.SelectedItem)
End Sub
</code>
Please help me... Thanks
FeRtoll Software.net
--------------------
I fertoll@net.hr I
--------------------
|
|
|
|
|
Please let me know what is your problem?? And what exactly you want to do
regards,
chandana
|
|
|
|
|
Chandana Subasinghe wrote: Please let me know what is your problem?? And what exactly you want to do
lol...
i did told u up there!!!
------------------------
I need that the selected item in listbox on other form goes to first form in text buth in the place where i was typeing...
thats all...
Need to save focus....
FeRtoll Software.net
--------------------
I fertoll@net.hr I
--------------------
|
|
|
|
|
10 days huh? I wish I was given 10 days to finish some of the jobs I have to do at work!
By the looks of this forum lately it seems that many people are doing the same (or similar) assignment.
The answer you seek is in the answer threads of other posts.
Have a look around
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
Steve Pullan wrote: The answer you seek is in the answer threads of other posts.
Have a look around
well is it that hard to tell the name of post...
nm...
thanks allot
FeRtoll Software.net
--------------------
I fertoll@net.hr I
--------------------
|
|
|
|
|
FeRtoll wrote: well is it that hard to tell the name of post...
nm...
thanks allot
Well is it THAT hard to actually look up and down the topic lists?
They are right there staring you in the face.
...Steve
quod erat demonstrandum
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
can u please tell me...
i think that you are wrong, you didnt understand!!!
FeRtoll Software.net
--------------------
I fertoll@net.hr I
--------------------
|
|
|
|
|
Thanks annyway to all.
FeRtoll Software.net
--------------------
I fertoll@net.hr I
--------------------
|
|
|
|
|
I get the following error when I try to update my access table with a datagrid
An unhandled exception of type 'system.invalidoperation" occured in system.data.dll'
The code I am using looks like this:
If CODE_DataSet.HasChanges Then
Dim CON As New OleDbConnection(CONNECT_STRING)
Dim MY_SQL As String
Dim CMD As OleDbCommand
Dim DR As OleDbDataReader
Dim data_adapter As OleDbDataAdapter
Dim command_builder As OleDbCommandBuilder
Dim select_string As String = "SELECT TMP_ADMIN.QUOTE_LINE_NO, TMP_ADMIN.OPTION, TMP_ADMIN.PRODUCT_CODE, TMP_ADMIN.DESCRIPTION, TMP_ADMIN.QTY, TMP_ADMIN.UNIT_COST, TMP_ADMIN.SELL, TMP_ADMIN.TAG FROM TMP_ADMIN;"
CMD = New OleDbCommand(select_string, CON)
data_adapter = New OleDbDataAdapter(select_string, CONNECT_STRING)
data_adapter.TableMappings.Add("Table", CODE_TABLE)
command_builder = New OleDbCommandBuilder(data_adapter)
command_builder.GetUpdateCommand()
data_adapter.Update(CODE_DataSet)
End If
Any ideas? is there a better way to upgrade my MSAccess tables from a datagrid?
|
|
|
|
|
put those on start of class:
Dim CON As New OleDbConnection(CONNECT_STRING)
Dim MY_SQL As String
Dim CMD As OleDbCommand
Dim DR As OleDbDataReader
Dim data_adapter As OleDbDataAdapter
Dim command_builder As OleDbCommandBuilder
what for is this one?
<blink><font color=#FF0000>Dim select_string As String = "SELECT TMP_ADMIN.QUOTE_LINE_NO, TMP_ADMIN.OPTION, TMP_ADMIN.PRODUCT_CODE, TMP_ADMIN.DESCRIPTION, TMP_ADMIN.QTY, TMP_ADMIN.UNIT_COST, TMP_ADMIN.SELL, TMP_ADMIN.TAG FROM TMP_ADMIN;"</font></blink>
you should put that in MY_SQL string up there:
Dim MY_SQL As String="SELECT TMP_ADMIN.QUOTE_LINE_NO, TMP_ADMIN.OPTION, TMP_ADMIN.PRODUCT_CODE, TMP_ADMIN.DESCRIPTION, TMP_ADMIN.QTY, TMP_ADMIN.UNIT_COST, TMP_ADMIN.SELL, TMP_ADMIN.TAG FROM TMP_ADMIN<blink><font color=#FF0000>;</font></blink>" 'And without this one!!! i think...
The third part:
Cmd = New OleDbCommand(MY_SQL, CON)
data_adapter = New OleDbDataAdapter(select_string, CONNECT_STRING)
data_adapter.TableMappings.Add("Table", <blink><font color=#FF0000>CODE_TABLE</font></blink>)
command_builder = New OleDbCommandBuilder(data_adapter)
command_builder.GetUpdateCommand()
data_adapter.Update(CODE_DataSet)
End If
<blink>And i dont see annywhere that u have defined the "CODE_TABLE" variable.
I think i have helped you... Good luck
FeRtoll Software.net
--------------------
I fertoll@net.hr I
--------------------
|
|
|
|
|
In your TMP_ADMIN table, do you have a primary key field? Are you returning that field in your SELECT statement? If not, you'll have to make one to use it with a DataAdapter.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I adjusted the Tmp_Admin table and set quote_line_no to the primary key and am now getting this error. Any Ideas
An unhandled exception of type 'System.Data.DBConcurrencyException' occurred in system.data.dll
Additional information: Concurrency violation: the UpdateCommand affected 0 records.
|
|
|
|
|
I ran into that once before. I can't remember what I did to cause it though...
Hmmmm....Well, let's start with cleaning up your code a bit:
If CODE_DataSet.HasChanges Then
Dim select_string As String = "SELECT TMP_ADMIN.QUOTE_LINE_NO, TMP_ADMIN.OPTION, " & _
"TMP_ADMIN.PRODUCT_CODE, TMP_ADMIN.DESCRIPTION, TMP_ADMIN.QTY, TMP_ADMIN.UNIT_COST, " & _
"TMP_ADMIN.SELL, TMP_ADMIN.TAG FROM TMP_ADMIN;"
Dim data_adapter As New OleDbDataAdapter(select_string, CONNECT_STRING)
Dim command_builder As New OleDbCommandBuilder(data_adapter)
data_adapter.TableMappings.Add("Table", CODE_TABLE)
data_adapter.Update(CODE_DataSet)
CODE_DataSet.Clear()
data_adapter.Fill(CODE_DataSet)
End If
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
THANKS
THAT WORKED GREAT!!
I APPRECIATE THE HELP!!
|
|
|
|
|
No problem!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using a treeview/listview combination. I want to use the treeview selection to populate what appears in the listview. As an additional note, the treeview will either display a list of companies or trades based on a radio button control.
Does anyone have a suggestion as to which event I should use to accomplish this?
I have tried the following;
AfterSelect event - the event appears to kickoff twice - once for the item that it is deselecting and one for the item it is selecting. When switching radio buttons, the event seems to run for each previous item in the list.
BeforeSelect event - does not know which node is selected
Click event - shows me the the last node selected
Any assistance is appreciated - Thank you in advance.
|
|
|
|
|
I just wanted to update this post in case anyone hapens to run across it.
When doing a treeview.nodes.clear - the afterselect event is actually kicking off for each previous node in the tree. Therefore if you are at node 1000 and you do a clear - the afterselect event kicks off that many times. To resolve the issue - you set the selectednode = nothing . . . see below for example.
If rdoByTrade.Checked Then
'Clear Listview
ListView1.Items.Clear()
ListView1.Columns.Clear()
TreeView1.SelectedNode = Nothing
TreeView1.Nodes.Clear()
'Load Treeview
LoadTree()
End If
In the afterselect event - I only process if treeview.selectednode.text <> nothing.
If TreeView1.SelectedNode.Text <> Nothing Then
LoadListView()
End If
|
|
|
|