Jump to content
Xtreme .Net Talk

hobbes2103

Avatar/Signature
  • Posts

    43
  • Joined

  • Last visited

Everything posted by hobbes2103

  1. Well, once the control is disabled, i cannot set the font anymore... I've pasted your code and the textbox stays desperately gray... It seems that once the control is disabled you cannot change its properties... Heeelp!
  2. When i click on Button1, TextBox1.Enabled = False, which naturally makes the text in TextBox1 appear in light grey, which is not very easy to read. Is there a way that you can change the font once that the enabled property is set on False? (I don't want to use the ReadOnly property) Thank you! :)
  3. Hi! In my form i have a panel with the autoscroll property set on true. When the I move the mouse on it, the focus gets on my panel and i can make the vertical scrollbar move up ans down with the mousewheel. Now i would like to be able to move the scrollbar up and down using the up and down keys of the key pad. In fact i don't know how to control the position of the vertical scrollbar of the panel with the code... Help is needed urgently...! :eek: Thank you!
  4. Hey! I have a form which is quite big, so i have the autoscroll property set on true. This form has many textboxes and the last textbox (Result) , the sum of all the contents of these textboxes, is what the user wants to see. Now, to see Result, which is at the bottom of the form, the user will need to use the vertical scrollbar. Is there a way that the textbox Result stays at the bottom of the screen (and not of the form) whatever the scrollbar position is, so that the user can see it whenever scrolling? (Result wouldn't be stuck at the bottom of the form but would stay visible at the bottom of the screen while scrolling) I hope I'm clear enouqh... :eek: Could you please help?? Thanks!
  5. Hi ! I have a form1 and when i press on button1 i want to open an existing Excel file, i write in it, i print it and then close it without saving changes. 'Opening the existing file Dim xlApp As Excel.Application Dim xlbook As Excel.Workbook Dim xlsheet As Excel.Worksheet xlApp = New Excel.Application xlbook = xlApp.Workbooks.Open(C:\Model.xls") xlsheet = xlApp.Sheets(1) xlsheet.Name = "Hello" '(Then comes all the writing in the sheet) 'Printing without saving xlsheet.PrintOut() xlApp.Quit() xlsheet = Nothing xlbook = Nothing xlApp = Nothing Now the problem is that when i execute the program, VB opens the files, writes an prints but when it closes the file i get the usual message from Excel asking me if i want to save the changes in the initial file. I don't want this message to appear, i want VB to automatically say "No" to it... How do i do that? Help is needed urgently... :eek: Thank you!!!!!
  6. Hi! I have a form1 and when i press on button1 it opens an Excel sheet, copies the text in cell A1 and pastes it in A2. I've tried this copy-paste code : xlsheet.Range("A1").Copy() xlsheet.Range("A2").Paste() Of course it doesn't work and i get an error message : i think i have to select A2 before pasting in it, but i can't figure ou the code for it... :confused: Can someone help me with the copy-paste syntax for Excel in VB.Net? Thank you!!!
  7. Hi! I have a form1 with a textbox1. When i press Enter another textbox appears below. As many textboxes as i want can appear. When i click on button1 i want textbox1 to reset and all the other textboxes to disappear. To do this i want to Reload form1 but i can't find the syntax (no Me.Reload found...! :mad: ) What is the syntax to reload a form by pressing on button1? Thank you!
  8. Thanks for your help, now the textboxes appear jsut regularly... Another problem though has appeares (i think it is bound to the autoscroll property) : when i press Enter, my next textbox appears (thank you!) and the form scrolls down a little bit so that i can see it. But this new text box is at the very botto of the form and partyl hidden (not very pretty)...! Is there a way that when the textbox is at the very bottom of the form, the form scrolls down a long way so that the textbox now appears at the top or middle of the form?
  9. The location of the twentifirst textbox should be (100,200 + 50*21) and that is not what is happening.
  10. No, i mean with the code txt.Location = New Point(100, 200 + 50 * i) the textboxes should be regularly positionned (with a distance of 50 between each of them) But when the scrolling happens, the textboxes are nor regularly disposed anymore : the distance between the twentifirst textbox and the twentieth is not 50 anymore.
  11. I have a form with a textbox on top of it. When i press Enter a new textbox appears below and gets the focus. I can add 50 textboxes this way The code for textbox number i is : Dim txt As New TextBox txt.Location = New Point(100, 200 + 50 * i) Me.Controls.Add(txt) AddHandler txt.KeyPress, AddressOf txt_keypress Now when i come to the twentieth textbox of course i'm at the bottom of the form and if i add more textboxes i don't see them. So i have activated the property AutoScroll. But there is a problem : now the form does scroll and i can see the new textboxes. The first textboxes appear just right, but when the form starts to scroll, they don't appear in their right location anymore (as if the location was modified by the scrolling) What is happening??? please help!!:eek:
  12. Thank you! (and don't worry it is not obvious at all to me)
  13. I have this problem with the Addhandler syntax : Tutorials all give this syntax AddHandler obj.event, AdressOf obj_event But I have the following code : Dim x As New TextBox() x.Name = "TextBox3" x.Location = New Point(112, 416) Me.Controls.Add(x) AddHandler x.MouseEnter, AddressOf textbox3_MouseEnter And 'TextBox3_MouseEnter' is underlined and i'm asked to declare it (and the prog won't work) Do i really have to declare it and if yes, how should i declare it? Please help me!! :eek:
  14. I've tries to paste this code but i get an error message that i have too declare myTxt_click and i dont't know what to declare it. And when i have created this myTxt_click sub, do i have to call 'private sub myTxt_click....' or 'private sub text(i)_click...'? I'm sorry i begin in vb.net
  15. Hello! I have a windows form with textbox1 on it When i click on textbox1 i want another textbox to appear below it, etc... The max number of textboxes that can appear is 50. My problem is to translate in VB.net code :"When i click on textbox number i, textbox number i+1 appears" I have tried this code : Private text(50) as textbox Dim I as integer For I = 1 to 50 do Private Sub text(I)_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles text(I).Click 'Adding textbox number i+1 Me.text(I+1) = New System.Windows.Forms.TextBox code(I+1).Location = New Point(100+10*(I+1), 400 + 10*(I+1)) Me.Controls.Add(code(I+1)) End Sub Next I The problem comes from the red part (text(I)_click) : text(I) gets underlined and the error message says that text(I) has already been declared in the class... Please help !! :eek:
  16. Hello! I have 3 textboxes (day, month and year) in which I enter separately the day, month and year. Then I create a date object Dim MyDate as date MyDate = day.text + "/" + month.text + "/" + year.text Then I can do date operations on MyDate. Until here, no problem, it works. But if I enter letters, or numbers that can't represent a date in one of the textboxes, the application stops running and there is an error message, which is normal. Now I want this error to be included in my code (if the date is not valid, there is a msgbox to alert the user and MyDate is not created and the application keeps running) Please help!! :eek:
  17. If you enter a date in textbox1, how do you get the previous day by pressing button1? I'm looking for a pre-built function Thank you!
  18. It doesn't work either.... (and in the french version of VB .net it is Day/month/year syntax)... I think there it is a problem with the '' (theremust be a # somewhere)
  19. Hello! I have a number that I have declared as string (for example 1,2345) If i click on button1 I want a msgbox to return the 3 numbers after the "," (in my example the msgbox would return 234) How do i do that???? :confused: Thank you!
  20. I want to select the names of the people where the field "age" is empty. I 've written my query this way : "SELECT name FROM MyTable WHERE age ='' " When I execute the program there is no result (0 record found, but there ARE people where the field "age" is empty in my table :confused: ) What is the right syntax for my query?
  21. I have this code that selects people who are born after 31/12/1980 : Dim MyCon As New OleDb.OleDbConnection Dim myReader As OleDb.OleDbDataReader Dim myConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source= " & Application.StartupPath & "\" & "mydatabase.mdb;" MyCon = New OleDb.OleDbConnection(myConnectionString) MyCon.Open() Dim myCommand As New OleDb.OleDbCommand Dim mySelect As String = "SELECT name, age FROM MyTable WHERE birthdate >'31/12/1980'" myCommand = New OleDb.OleDbCommand(mySelect, MyCon) The problem comes from the selection by date because if I select by name or by age, it works. How do i have to write the '31/12/1980' so that there is no "unhandled exception"? Thank you!
  22. I have the following code to write into an existing Excel file : Dim xlApp As Excel.Application Dim xlbook As Excel.Workbook Dim xlsheet As Excel.Worksheet xlapp = New Excel.Application xlbook = xlApp.Workbooks.Open("C:\MyFile.xls") xlsheet = xlApp.Sheets(1) xlsheet.Name = "Ma Feuille Excel" xlsheet.Range("A1").Value = "Bienvenue" Now I would like to do things such as drawing a frame on the cell, or changing the font or size of the text... How do i do that? :confused:
  23. Well, I've tried this code : Dim myConnection As New OleDb.OleDbConnection Dim myCommand As New OleDb.OleDbCommand Dim myConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Database.mdb" myConnection = New OleDb.OleDbConnection(myConnectionString) myConnection.Open() Dim mySelect As String = "SELECT name, birthdate FROM MyTable" myCommand = New OleDb.OleDbCommand(mySelect, myConnection) Dim oledb_adap As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter oledb_adap.SelectCommand = myCommand Dim data_set As DataSet = New DataSet oledb_adap.Fill(data_set) DataGrid1.SetDataBinding(data_set, "MyTable") It works...except for the last line, the datagrid filling, which is where an error occurs... There is an "unhandled exception", The message says (I'm translating from french so i don't know if it is right) "Impossible to create a child list (?) for the field MyTable" Please help!!
×
×
  • Create New...