|
Sir Rage of Rage-shire, thou art a God!
P*sser number 1...when the System.Design shows up with other stuff, like it's already referenced. Things like that just lower your trust of things you take for granted as being straight forward.
Ah well, onwards and upwards.
Oh by the way...I solved my problem of icons for my controls not showing up in the toolbox. I renamed my controls, to divorce them of any old stuff in the registry, and guess what, yep, you don't have that surprised look on your face, so you know...it worked! P*sser number 2, follow the rules but if your registry is strangely screwed for whatever reason then its gonna bite yah! 8-(
As soon as I referenced system.design explicitly the new uitype designer stuff was all plugged in.
Thanks a million!
Nursey
|
|
|
|
|
Hi everyone
Look, I'm looking to resolve how can i refresh the data from a datagrid.
example.
I have form A and Form B. In the form A i have the Datagrid, but I'm in form B. How can I refresh the datagrid from form B button?.
Johnny
|
|
|
|
|
What Am I doing wrong?
I am getting the message object is close
Dim objcnn1 As New ADODB.Connection
Dim objcmd1 As New ADODB.Command
Dim objrst1 As New ADODB.Recordset
Dim str As String
Dim GConnection As String
objcnn1.Open "Provider=MSDASQL.1;password =;User Id = ;Data Source=TEST;"
objcmd1.ActiveConnection = objcnn1
With objrst1
.ActiveConnection = objcnn1
.CursorType = adOpenDynamic
End With
sDownload = "SELECT * FROM test "
objrst1.Open sDownload
Do While Not objrst1.EOF
MsgBox " " & sDownload
objrst1.MoveNext
Loop
|
|
|
|
|
as such you are using the MSDASQL provider
u r here not specifying the path of the source
i think that u should specify the path of the source
else wise he will take the application path
also u r using the MSDASQL provider then i think that you have to login the SQL server to access the database
i m not sure abt it
check whether the objcnn1 is open or not and get the error
from err.number
first do the connection and then do the rest of the things with that object
VickyMD A Specialist in Message Digest Security
|
|
|
|
|
First, you're using some bad programming techniques that will lead to some overhead in the Code. Anytime you Declare a Variable with the "...As New" and it's an Object, then every time you set a Property or use a Method, the VB Compiler ALWAYS checks to see if the Object has been instantiated...this is some significant overhead if you use this routine a lot.
Actually, it looks like the whole Connection String is wrong... The Provider "MSDASQL" is strictly used for DataSources that reside in the ODBC DataSources. If this is the Case, and you do not have a User / Password, then leave those Parameters out. Also, do not put a SemiColon at the end of the Connection String.
Also, why did you make an "ADODB.Command" Object if you never used it??
NOTE: Also, you better learn the difference between Dynamic, ForwardOnly, Static, and Keyset cursors before you program any further, you are not making the most efficient use of resources...
Dim adoCon As ADODB.Connection
Dim rsData As ADODB.Recordset
'Open the Connection
Set adoCon = New ADODB.Connection
'objcnn1.Open "Provider=MSDASQL.1;password =;User Id = ;Data Source=TEST;" (Wrong)
adoCon.Open "Provider=MSDASQL.1;Data Source=TEST"
'Open the Recordset
'Open ForwardOnly / ReadOnly because we are only Enumerating the Records (maybe filling a ComboBox)
Set rsData = New ADODB.Recordset
rsData.CursorLocation = adUseClient
rsData.Open "Select * From Test", adoCon, adOpenForwardOnly, adLockReadOnly, adCmdText
While (Not rsData.EOF)
MsgBox " " & rsData.Fields(0).Value 'sDownload (Huh?)
'MsgBox " " & rsData.Fields("FieldName").Value
'MsgBox " " & rsData!FieldName
'MsgBox " " & CStr(rsData!StringField)
'MsgBox " " & CInt(rsData!NumberField)
rsData.MoveNext
Wend
|
|
|
|
|
How do I override where the rich text box draws to an area.
What I would like to do, is to have the rich text box output go to a picturebox.
If needed, I can supply the 'shareware' paint program that I have updated, so you can see why this becomes important.
|
|
|
|
|
Just thought I would run this past you again, as I hit a blank before...
I have a panel control, which draws a form like caption at the top. Problem is, if I place a control in that panel and dock the control at the top of the panel, the new control obscures the caption. Can I control the CLIENT area in such a way that when the control docks, it fits beneath the caption? Is this something to do with SetClientSizeCore?
Thanks
Nursey
|
|
|
|
|
Heya,
I'm trying To create a windows service that picks messages off of a MS message queue and send them to a GSM modem. I can post a message to the queue with a standard Windows app so there's no problem connecting to the queue. The problem is, I've made a service that finds the queue and begins receiving, it just never calls the ReceiveCompleted event, or if it does I never see it happen. I know it reads the queue once because if there is a message on the queue it disappears as soon as the service is started. If I add a message after that nothing happens.
The code is as follows:
Private Sub HookQueue()
Try
' Initialise our queue
SMSMessageQueue = New MessageQueue(".\private$\SMSMessaging")
SMSMessageQueue.Formatter = New System.Messaging.XmlMessageFormatter(New String() {"LAB.Messaging.SMS.SMSMessage"})
AddHandler SMSMessageQueue.ReceiveCompleted, AddressOf SMSMessageReceived
SMSMessageQueue.BeginReceive()
Catch exp As MessageQueueException
EventLog.WriteEntry(exp.Message)
Catch exp As Exception
EventLog.WriteEntry(exp.Message)
End Try
End Sub
And the event code:
Private Sub SMSMessageReceived(ByVal sender As Object, ByVal e As System.Messaging.ReceiveCompletedEventArgs) Handles SMSMessageQueue.ReceiveCompleted
Try
Dim SMSMessage As Message = sender.EndReceive(e.AsyncResult) 'SMSMessageQueue
Dim oMessage As LAB.Messaging.SMS.SMSMessage = CType(SMSMessage.Body, LAB.Messaging.SMS.SMSMessage)
'TODO: Send message to GSM Modem here
SMSMessageQueue.BeginReceive()
Catch exp As MessageQueueException
EventLog.WriteEntry(exp.Message)
Catch exp As Exception
EventLog.WriteEntry(exp.Message)
End Try
End Sub
I can't think of anything I'm doing wrong.
Thanks
Nicholas Rowan
The man who smiles when things go wrong has thought of someone he can blame it on.
If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.
|
|
|
|
|
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles opslaan.Click
FileOpen(1, "C:\Documents and Settings\Jurgen\Mijn documenten\Visual Studio Projects\Data test1\Data Testje 1\Log_uren_bijhouden.txt", OpenMode.Output) ' Open file for output.
Print(1, TimeOfDay, Today) ' Print text to file.
PrintLine(1) 'sluit 1ste regel af
PrintLine(1)
PrintLine(1, nummer.Text, naam.Text, achternaam.Text)
PrintLine(1, "Begonnen om", TAB(1), beginuur.Text) ' Print in two print zones.
PrintLine(1, "Beeindigd om", TAB(1), eindeuur.Text) ' Separate strings with space.
PrintLine(1)
PrintLine(1, TAB(10), "END", TAB(20), "END") ' Print word at column 10.
PrintLine(1, "-------------------------------------------------------------------")
FileClose(1) ' Close file.
End Sub
I want to add every time I klik a Button a new line with these text in the file.
now when i try to do that he overwrites every time the existing Data.
It has to somthing like a log file.
I use Visual Basic.net, this because i can't work very wel with C++
Sombody a hint or a Solution,
Thanks
Jurgen De Bondt
Thats ........ Me
|
|
|
|
|
Change the OpenMode.Output to OpenMode.Append.
RageInTheMachine9532
|
|
|
|
|
Thanks a lot. It works
|
|
|
|
|
i have form1 and form2, form1 has a picturebox which i wish to make it accessible to other forms
after form2 perform some drawing, it need to call form1.picbox.invalidate() to refresh the picbox, how to declare the picbox?anyone have idea?
dim frm1 as form1<br />
frm1 = new form1()<br />
<br />
frm1.picbox.invalidate
the above code will not work becoz i not wish to create a new instance of form1, wat i wan is to refresh the picbox that already has some drawing on the activated form1..
any help is greatly appreciated...
|
|
|
|
|
|
i set variable as a bitmap buffer
dim bufferBmp As Bitmap
Dim myfont As Font = New Font(New FontFamily("Arial"), 8, FontStyle.Regular)
when i use drawstring on the bitmap and display it on a picbox
g.DrawString("Start", myfont, mysolidbrush, startdrawx, d)
the output of the string seems like become bolded and unclear, it will never happen when i draw directly on the picturebox, i need to use bitmap buffer due to certain reasons, somebody suggested me set the pixel format of the bmp using Format32bppArgb or Format32bppPArgb.
but i really a beginner in VB.Net, anyone can provide me the sample coding to set the format??
thanks for any help!!
|
|
|
|
|
You might want to try creating your Bitmap object using the Grpahics object of the PicBox.
Dim grPicBox as Graphics = PicBox.CreateGraphics()
Dim bufferBmp As New Bitmap(Width, Height, grPicBox)
This will give your Bitmap the same PixelFormat as the PicBox. The only down side is you have to give the Width and Height of the buffer.
RageInTheMachine9532
|
|
|
|
|
In visual basic .net, for the database concepts
i am in position to operate my transactionsthrough three architecture.
so that i can support the multiuser environment.In this concept i had a diffculity.I need to put my middle tier-datasets as a global.so that while filling the data from database to dataset i can distribute to all the clients acessing the my middle tier.so i can avoid the frequent hitting the database and also i need not to be fill the datasets often.Pls can anyone help me on this.And also suggest me about the idea what i had followed.
Sriram
|
|
|
|
|
See my reply in the ASP.NET[^] forum.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
How can I with Tabcontrol select or focus any TabPage with code.
I don't know how do this.
Johnny
|
|
|
|
|
You can do this using the SelectedIndex of the TabControl. SelectedIndex will get or set the Index of the currently selected tab. For example, the following code assumes that there is a Button and a TabControl on the form. The Button is used to select the next tab in the TabControl.
Dim currentTab As Integer
Dim highestTab As Integer
Private Sub cbNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbNext.Click
Dim nextTab As Integer = currentTab + 1
If nextTab > highestTab Then
nextTab = 0
End If
TabControl1.SelectedIndex = nextTab
currentTab = TabControl1.SelectedIndex
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
currentTab = TabControl1.SelectedIndex
highestTab = TabControl1.TabCount - 1
End Sub
RageInTheMachine9532
|
|
|
|
|
I just want to know ,how can i use this code on TAB select,i have been trying this on Tab select,instead of Button click,in order to get effect this on Tab select ,On which event should i write the code.u can mail me shihab@vatimsolutions.com...Thanxs in advance.
|
|
|
|
|
The code I submitted was an example of how to change the Tab in code. You can use the same code in a different routine if you want. Just the most important part was TabControl1.SelectedIndex = (tab number). The rest was just keeping track of which tab was selected and what the next tab number is.
Using the TabPage.Select method doesn't work the way you would expect it to. The user won't see any change in the tab that is shown if you use that method.
RageInTheMachine9532
|
|
|
|
|
Hi again,
Onwards with my list of woes...
I have a floating panel container which folds away whenever it looses focus or isn't being pointed at with the mouse. When I popup a context menu my panel thinks its time to fold away! Bugger!
If my floating panel contains the focus all is well, but if its not focused, and it just opens because I pointed at it with the mouse, then when I open a context menu from the panel, the system thinks I am no longer pointing at the panel, and its right, because I am pointing at the menu. I need to hold the panel open whilst the menu is being processed. What's the best way to know when the menu has closed, without sticking code in all its menu item click event handlers?
I will know when the menu is first opened, I just don't know how to catch it being closed.
Thanks for reading
Nursey
|
|
|
|
|
Is there a simple straight forward method of persisting properties of child controls which are contained within user controls?
I have a user control which inherits from panel, on that panel is a single text box. The panel user control exposes the text box through a HostedControl property so that the user can set the MultiLine property at designtime. However, that property change is not serialized. It seems that I either have to expose a multiline property on the user control which drives the text box property, or I have to somehow serialize the properties of the text box myself.
Any pointers would be appreciated (ooh, provided there to valid memory locations ).
Just to make this abolutely clear. When I add the text box to the Panel user control, if I set the multiline property then all is well, but when I compile my panel/text hybrid control and place it on a form, then all the properties from the panel user control are serialised, but the properties of the text box are not. I view this as pretty obvious behaviour which seems to make sense, but how do I work around it?
Nursey
|
|
|
|
|
at design time on the panel control, set Modifiers property of the textbox to Public or Friend. no need to use anaa property 2 xpose the same.
then u'll b able to manipulate the text box anywhere.
|
|
|
|
|
Kamush,
Thanks, but that's not the answer. First, I have already exposed the text box as you say by making it public. But two things, firstly when the programmer changes the properties at DESIGN TIME, the windows designer doesn't seem to generate code to effect those property changes at run time. I don't know why. Second, I asked, can my PANEL control expose all the events of the TextBox. My feeling is it can't, without inheriting TextBox, which I can't do because I want a panel that CONTAINS a text box.
As I said, this kind of makes sense but its frustrating. or....I still don't understand something, and your answer is right, and my understanding of it is wrong 8-)
Thanks.
Nursey
|
|
|
|
|