Search Results

Search found 4472 results on 179 pages for 'vb'.

Page 21/179 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Regular expression from font to span (size and colour) and back (VB.NET)

    - by chapmanio
    Hi, I am looking for a regular expression that can convert my font tags (only with size and colour attributes) into span tags with the relevant inline css. This will be done in VB.NET if that helps at all. I also need a regular expression to go the other way as well. To elaborate below is an example of the conversion I am looking for: <font size="10">some text</font> To then become: <span style="font-size:10px;">some text</span> So converting the tag and putting a "px" at the end of whatever the font size is (I don't need to change/convert the font size, just stick px at the end). The regular expression needs to cope with a font tag that only has a size attribute, only a color attribute, or both: <font size="10">some text</font> <font color="#000000">some text</font> <font size="10" color="#000000">some text</font> <font color="#000000" size="10">some text</font> I also need another regular expression to do the opposite conversion. So for example: <span style="font-size:10px;">some text</span> Will become: <font size="10">some text</font> As before converting the tag but this time removing the "px", I don't need to worry about changing the font size. Again this will also need to cope with the size styling, font styling, and a combination of both: <span style="font-size:10px;">some text</span> <span style="color:#000000;">some text</span> <span style="font-size:10px; color:#000000;">some text</span> <span style="color:#000000; font-size:10px;">some text</span> I apprecitate this is a lot to ask, I am hopeless with regular expressions and need to find a way of making these conversions in my code. Thanks so much to anyone that can/is willing to help me!

    Read the article

  • Get Confirm value in vb.net

    - by user1805641
    I have a hidden asp Button in a Repeater. In the VB.NET code behind I use the Rerpeater_ItemCommand to get the click event within the Repeater. There's a check if user is already recording a project. If yes and he wants to start a new one, a confirm box should appear asking "Are you sure?" How can I access the click value from confirm? <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand"> <ItemTemplate> <div class="tile user_view user_<%# Eval("employeeName") %>"> <div class="tilesheight"></div> <div class="element"> <asp:Button ID="Button1" CssClass="hiddenbutton" runat="server" /> Index: <asp:Label ID="Label1" runat="server" Text='<%# Eval("index") %>' /><br /> <hr class="hr" /> customer: <asp:Label ID="CustomerLabel" runat="server" Text='<%# Eval("customer") %>' /><br /> <hr class ="hr" /> order: <asp:Label ID="OrderNoLabel" runat="server" Text='<%# Eval("orderNo") %>' /><br /> <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("description") %>' /><br /> <hr class="hr" /> </div> </div> </ItemTemplate> </asp:Repeater> code behind: If empRecs.Contains(projects.Item(index.Text).employeeID) Then 'Catch index of recording order i = empRecs.IndexOf(projects.Item(index.Text).employeeID) Page.ClientScript.RegisterStartupScript(Me.GetType, "confirm", "confirm('Order " & empRecs(i + 2) & " already recording. Would you like to start a new one?')",True) 'If users clicks ok insertData() End If Other solutions are using the Click Event and a hidden field. But the problem is, I don't want the confirmbox to appear every time the button is clicked. Only when empRecs conatins an employee. Thanks for helping

    Read the article

  • A C# Version of DotNetNuke

    - by Chris Hammond
    Did you hear the news? You can get DotNetNuke in C# now! What? Say it ain’t so, DotNetNuke has abandoned VB.NET? Well not quite, the release and production version of DotNetNuke is still in VB.NET, though a kind soul has spent some time lately converting DNN to C#. For all the details you can check out Scott’s blog post over on DotNetNuke.com Never fear VB lovers, DotNetNuke isn’t moving away from VB.NET anytime soon (afaik), but this C# port of the project is just another way for people to get involved...(read more)

    Read the article

  • APress Deal of the Day - 30/Nov/2011 - Moving to VB .NET Strategies, Concepts, and Code

    - by TATWORTH
    Today's $10 Deal of the day from APress at  is Dan Appleman's "Moving to VB .NET Strategies, Concepts, and Code"."Visual Basic guru Dan Appleman exposes the reality behind the VB .NET hype, and shows you how to evaluate this technology in the context of your specific problems."Considering the vast amount of VB6 still in use, this book from 2001 will be of immense help to all tasked with converting Vb6 to VB.NET or C#.

    Read the article

  • Help migrating from VB style programming to OO programming [closed]

    - by Agent47DarkSoul
    Being a hobbyist Java developer, I quickly took on with OO programming and understood its advantages over procedural code from C, that I did in college. But I couldn't grasp VB event based code (weird, right?). Bottom-line is OOP came natural to me. Curently I work in a small development firm developing C# applications. My peers here are a bit attached to VB style programming. Most of the C# code written is VB6 event handling code in C#'s skin. I tried explaining to them OOP with its advantages but it wasn't clear to them, maybe because I have never been much of a VB programmer. So can anybody provide any resources: books, web articles on how to migrate from VB style to OO style programming ?

    Read the article

  • Repeater not repeating :0) (asp.net)(vb)

    - by Phil
    Morning stackoverflow, I have a repeater, with the following code in my aspx page; <asp:Repeater ID="Contactinforepeater" runat="server"> <HeaderTemplate> <h1>Contact Information</h1> </HeaderTemplate> <ItemTemplate> <table width="50%"> <tr> <td colspan="2"><%#Container.DataItem("position")%></td> </tr> <tr> <td>Name:</td> <td><%#Container.DataItem("surname")%></td> </tr> <tr> <td>Telephone:</td> <td><%#Container.DataItem("telephone")%></td> </tr> <tr> <td>Fax:</td> <td><%#Container.DataItem("fax")%></td> </tr> <tr> <td>Email:</td> <td><%#Container.DataItem("email")%></td> </tr> </table> </ItemTemplate> <SeparatorTemplate> <br /><hr /><br /> </SeparatorTemplate> </asp:Repeater> Then I have this code in my aspx.vb to get the data; If did = 0 Then s = "sql works on db server" x = New SqlCommand(s, c) x.Parameters.Add("@contentid", Data.SqlDbType.Int) x.Parameters("@contentid").Value = contentid c.Open() r = x.ExecuteReader r.Read() Contactinforepeater.DataSource = r Contactinforepeater.DataBind() End If c.Close() r.Close() If Not did = 0 Then s = "sql works on db server" x = New SqlCommand(s, c) x.Parameters.Add("@contentid", SqlDbType.Int) x.Parameters("@contentid").Value = contentid x.Parameters.Add("@did", SqlDbType.Int) x.Parameters("@did").Value = did c.Open() r = x.ExecuteReader r.Read() Contactinforepeater.DataSource = r Contactinforepeater.DataBind() End If r.Close() c.Close() If 'did' is or is not '0' I still get no data outputted to the page. I just get the 'contact information' h1 header from the header template. I've tested the value of s in sqlsms and it works fine. Position, surname, telephone, fax, email all exist in the db. The particular page I am checking exists and has 1 set of contact information attached. Where am I going wrong? Thanks! ps. Does my syntax appear correct? pps. I am also open to different ways of achieving the same result. I tried via an sqldatasource but ran into problems when using variables as params (there is no option to select them, only controls, querystring etc)

    Read the article

  • Font serialization in vb.net

    - by jovany
    Hello all, as the title says , I need to serialize my font. I have tried the following approach unfortunately to no avail. This is what I have and what happens; I have a drawing application and certain variables and properties need to be serialized. (So , Xml.Serialization has been used.) Now this has already been done in a huge portion and I've created some other attributes which needed to be serialized and it works. There is one base class and classes such as drawablestar, drawableeclipse ,etc. all inherit from this class. As does my drawabletextboxclass. The base class is Serializable as can be seen in the sample below. It looks like this... Imports System.Xml.Serialization <Serializable()> _ Public MustInherit Class Drawable ' Drawing characteristics. 'Font characteristics <XmlIgnore()> Public FontFamily As String <XmlIgnore()> Public FontSize As Integer <XmlIgnore()> Public FontType As Integer <XmlIgnore()> Public ForeColor As Color <XmlIgnore()> Public FillColor As Color <XmlAttributeAttribute()> Public LineWidth As Integer = 0 <XmlAttributeAttribute()> Public X1 As Integer <XmlAttributeAttribute()> Public Y1 As Integer <XmlAttributeAttribute()> Public X2 As Integer <XmlAttributeAttribute()> Public Y2 As Integer ' attributes for size textbox <XmlAttributeAttribute()> Public widthLabel As Integer <XmlAttributeAttribute()> Public heightLabel As Integer '<XmlTextAttribute()> Public FontFamily As String '<XmlAttributeAttribute()> Public FontSize As Integer 'this should actually not be here.. <XmlAttributeAttribute()> Public s_InsertLabel As String ' Indicates whether we should draw as selected. <XmlIgnore()> Public IsSelected As Boolean = False ' Constructors. Public Sub New() ForeColor = Color.Black FillColor = Color.White 'FontFamily = "Impact" 'FontSize = 12 End Sub Friend WriteOnly Property _Label() As String Set(ByVal Value As String) s_InsertLabel = Value End Set End Property Public Sub New(ByVal fore_color As Color, ByVal fill_color As Color, Optional ByVal line_width As Integer = 0) LineWidth = line_width ForeColor = fore_color FillColor = fill_color ' FontFamily = Font_Family ' FontSize = Font_Size End Sub ' Property procedures to serialize and ' deserialize ForeColor and FillColor. <XmlAttributeAttribute("ForeColor")> _ Public Property ForeColorArgb() As Integer Get Return ForeColor.ToArgb() End Get Set(ByVal Value As Integer) ForeColor = Color.FromArgb(Value) End Set End Property <XmlAttributeAttribute("BackColor")> _ Public Property FillColorArgb() As Integer Get Return FillColor.ToArgb() End Get Set(ByVal Value As Integer) FillColor = Color.FromArgb(Value) End Set End Property 'Property procedures to serialize and 'deserialize Font <XmlAttributeAttribute("InsertLabel")> _ Public Property InsertLabel_() As String Get Return s_InsertLabel End Get Set(ByVal value As String) s_InsertLabel = value End Set End Property <XmlAttributeAttribute("FontSize")> _ Public Property FontSizeGet() As Integer Get Return FontSize End Get Set(ByVal value As Integer) FontSize = value End Set End Property <XmlAttributeAttribute("FontFamily")> _ Public Property FontFamilyGet() As String Get Return FontFamily End Get Set(ByVal value As String) FontFamily = value End Set End Property <XmlAttributeAttribute("FontType")> _ Public Property FontType_() As Integer Get Return FontType End Get Set(ByVal value As Integer) FontType = value End Set End Property #Region "Methods to override" Public MustOverride Sub Draw(ByVal gr As Graphics) ' Return the object's bounding rectangle. Public MustOverride Function GetBounds() As Rectangle ...... ........ ..... End Class [/code] My textbox class which looks like this , is the one that needs to save it's font. Imports System.Math Imports System.Xml.Serialization Imports System.Windows.Forms <Serializable()> _ Public Class DrawableTextBox Inherits Drawable Private i_StringLength As Integer Private i_StringWidth As Integer Private drawFont As Font = New Font(FontFamily, 12, FontStyle.Regular) Private brsTextColor As Brush = Brushes.Black Private s_insertLabelTextbox As String = "label" ' Constructors. Public Sub New() End Sub Public Sub New(ByVal objCanvas As PictureBox, ByVal fore_color As Color, ByVal fill_color As Color, Optional ByVal line_width As Integer = 0, Optional ByVal new_x1 As Integer = 0, Optional ByVal new_y1 As Integer = 0, Optional ByVal new_x2 As Integer = 1, Optional ByVal new_y2 As Integer = 1) MyBase.New(fore_color, fill_color, line_width) Dim objGraphics As Graphics = objCanvas.CreateGraphics() X1 = new_x1 Y1 = new_y1 'Only rectangles ,circles and stars can resize for now b_Movement b_Movement = True Dim frm As New frmTextbox frm.MyFont = drawFont frm.ShowDialog() If frm.DialogResult = DialogResult.OK Then FontFamily = frm.MyFont.FontFamily.Name FontSize = frm.MyFont.Size FontType = frm.MyFont.Style 'drawFont = frm.MyFont drawFont = New Font(FontFamily, FontSize) drawFont = FontAttributes() brsTextColor = New SolidBrush(frm.txtLabel.ForeColor) s_InsertLabel = frm.txtLabel.Text i_StringLength = s_InsertLabel.Length 'gefixtf Dim objSizeF As SizeF = objGraphics.MeasureString(s_InsertLabel, drawFont, New PointF(X2 - X1, Y2 - Y1), New StringFormat(StringFormatFlags.NoClip)) Dim objPoint As Point = objCanvas.PointToClient(New Point(X1 + objSizeF.Width, Y1 + objSizeF.Height)) widthLabel = objSizeF.Width heightLabel = objSizeF.Height X2 = X1 + widthLabel Y2 = Y1 + heightLabel Else Throw New ApplicationException() End If End Sub ' Draw the object on this Graphics surface. Public Overrides Sub Draw(ByVal gr As System.Drawing.Graphics) ' Make a Rectangle representing this rectangle. Dim rectString As Rectangle rectString = New Rectangle(X1, Y1, widthLabel, heightLabel) rectString = GetBounds() ' See if we're selected. If IsSelected Then gr.DrawString(s_InsertLabel, drawFont, brsTextColor, X1, Y1) 'gr.DrawRectangle(Pens.Black, rect) ' Pens.Transparent gr.DrawRectangle(Pens.Black, rectString) ' Draw grab handles. DrawGrabHandle(gr, X1, Y1) DrawGrabHandle(gr, X1, Y2) DrawGrabHandle(gr, X2, Y2) DrawGrabHandle(gr, X2, Y1) Else gr.DrawString(s_InsertLabel, drawFont, brsTextColor, X1, Y1) 'gr.DrawRectangle(Pens.Black, rect) ' Pens.Transparent gr.DrawRectangle(Pens.Black, rectString) End If End Sub 'get fontattributes Public Function FontAttributes() As Font Return New Font(FontFamily, 12, FontStyle.Regular) End Function ' Return the object's bounding rectangle. Public Overrides Function GetBounds() As System.Drawing.Rectangle Return New Rectangle( _ Min(X1, X1), _ Min(Y1, Y1), _ Abs(widthLabel), _ Abs(heightLabel)) End Function ' Return True if this point is on the object. Public Overrides Function IsAt(ByVal x As Integer, ByVal y As Integer) As Boolean Return (x >= Min(X1, X2)) AndAlso _ (x <= Max(X1, X2)) AndAlso _ (y >= Min(Y1, Y2)) AndAlso _ (y <= Max(Y1, Y2)) End Function ' Move the second point. Public Overrides Sub NewPoint(ByVal x As Integer, ByVal y As Integer) X2 = x Y2 = y End Sub ' Return True if the object is empty (e.g. a zero-length line). Public Overrides Function IsEmpty() As Boolean Return (X1 = X2) AndAlso (Y1 = Y2) End Function End Class The coordinates ( X1 ,X2,Y1, Y2 ) are needed to draw a circle , rectangle etc. ( in the other classes ).This all works. If I load my saved file it shows me the correct location and correct size of drawn objects. If I open my xml file I can see all values are correctly saved ( including my FontFamily ). Also the color which can be adjusted is saved and then properly displayed when I load a previously saved drawing. Of course because the coordinates work, if I insert a textField ,the location where it is being displayed is correct. However here comes the problem , my fontSize and fontfamily don't work. As you can see I created them in the base class, However this does not work. Is my approach completely off? What can I do ? Before saving img14.imageshack.us/i/beforeos.jpg/ After loading the Font jumps back to Sans serif and size 12. I could really use some help here.. Edit: I've been using the sample from this website http://www.vb-helper.com/howto_net_drawing_framework.html

    Read the article

  • Is there a way to implement Caliburn-like co-routines in VB.NET since there's no yield keyword

    - by Miroslav Popovic
    Note that I'm aware of other yield in vb.net questions here on SO. I'm playing around with Caliburn lately. Bunch of great stuff there, including co-routines implementation. Most of the work I'm doing is C# based, but now I'm also creating an architecture guideline for a VB.NET only shop, based on Rob's small MVVM framework. Everything looks very well except using co-routines from VB. Since VB 10 is used, we can try something like Bill McCarthy's suggestion: Public Function Lines(ByVal rdr as TextReader) As IEnumerable(Of String) Return New GenericIterator(Of String) (Function(ByRef nextItem As String) As Boolean nextItem = rdr.ReadLine Return nextItem IsNot Nothing End Function) End Function I'm just failing to comprehend how a little more complex co-routine method like the one below (taken from Rob's GameLibrary) could be written in VB: public IEnumerable<IResult> ExecuteSearch() { var search = new SearchGames { SearchText = SearchText }.AsResult(); yield return Show.Busy(); yield return search; var resultCount = search.Response.Count(); if (resultCount == 0) SearchResults = _noResults.WithTitle(SearchText); else if (resultCount == 1 && search.Response.First().Title == SearchText) { var getGame = new GetGame { Id = search.Response.First().Id }.AsResult(); yield return getGame; yield return Show.Screen<ExploreGameViewModel>() .Configured(x => x.WithGame(getGame.Response)); } else SearchResults = _results.With(search.Response); yield return Show.NotBusy(); } Any idea how to achieve that, or any thoughts on using Caliburn co-routines in VB?

    Read the article

  • TreeGridView in VB.NET 3.5

    - by hgulyan
    Hi, I need a control like a TreeView, but with option to use multiple columns in a node. There's a controls called TreeListView on codeproject (link text), but it's doesn't have some features I need. 1) I need a key on every node or somehow bind an object to the control. 2) I need to change node image(like in file systems - folders and files) 3) I need a CheckBox on every node 4) I need path and level of a node. Does anyone know a windows control, that does all this? Thank you.

    Read the article

  • VB.Net Dynamically Load DLL

    - by hermiod
    I am trying to write some code that will allow me to dynamically load DLLs into my application, depending on an application setting. The idea is that the database to be accessed is set in the application settings and then this loads the appropriate DLL and assigns it to an instance of an interface for my application to access. This is my code at the moment: Dim SQLDataSource As ICRDataLayer Dim ass As Assembly = Assembly. _ LoadFrom("M:\MyProgs\WebService\DynamicAssemblyLoading\SQLServer\bin\Debug\SQLServer.dll") Dim obj As Object = ass.CreateInstance(GetType(ICRDataLayer).ToString, True) SQLDataSource = DirectCast(obj, ICRDataLayer) MsgBox(SQLDataSource.ModuleName & vbNewLine & SQLDataSource.ModuleDescription) I have my interface (ICRDataLayer) and the SQLServer.dll contains an implementation of this interface. I just want to load the assembly and assign it to the SQLDataSource object. The above code just doesn't work. There are no exceptions thrown, even the Msgbox doesn't appear. I would've expected at least the messagebox appearing with nothing in it, but even this doesn't happen! Is there a way to determine if the loaded assembly implements a specific interface. I tried the below but this also doesn't seem to do anything! For Each loadedType As Type In ass.GetTypes If GetType(ICRDataLayer).IsAssignableFrom(loadedType) Then Dim obj1 As Object = ass.CreateInstance(GetType(ICRDataLayer).ToString, True) SQLDataSource = DirectCast(obj1, ICRDataLayer) End If Next EDIT: New code from Vlad's examples: Module CRDataLayerFactory Sub New() End Sub ' class name is a contract, ' should be the same for all plugins Private Function Create() As ICRDataLayer Return New SQLServer() End Function End Module Above is Module in each DLL, converted from Vlad's C# example. Below is my code to bring in the DLL: Dim SQLDataSource As ICRDataLayer Dim ass As Assembly = Assembly. _ LoadFrom("M:\MyProgs\WebService\DynamicAssemblyLoading\SQLServer\bin\Debug\SQLServer.dll") Dim factory As Object = ass.CreateInstance("CRDataLayerFactory", True) Dim t As Type = factory.GetType Dim method As MethodInfo = t.GetMethod("Create") Dim obj As Object = method.Invoke(factory, Nothing) SQLDataSource = DirectCast(obj, ICRDataLayer) EDIT: Implementation based on Paul Kohler's code Dim file As String For Each file In Directory.GetFiles(baseDir, searchPattern, SearchOption.TopDirectoryOnly) Dim assemblyType As System.Type For Each assemblyType In Assembly.LoadFrom(file).GetTypes Dim s As System.Type() = assemblyType.GetInterfaces For Each ty As System.Type In s If ty.Name.Contains("ICRDataLayer") Then MsgBox(ty.Name) plugin = DirectCast(Activator.CreateInstance(assemblyType), ICRDataLayer) MessageBox.Show(plugin.ModuleName) End If Next I get the following error with this code: Unable to cast object of type 'SQLServer.CRDataSource.SQLServer' to type 'DynamicAssemblyLoading.ICRDataLayer'. The actual DLL is in a different project called SQLServer in the same solution as my implementation code. CRDataSource is a namespace and SQLServer is the actual class name of the DLL. The SQLServer class implements ICRDataLayer, so I don't understand why it wouldn't be able to cast it. Is the naming significant here, I wouldn't have thought it would be.

    Read the article

  • Update XML element with LINQ to XML in VB.NET

    - by Bayonian
    Hi, I'm trying to update an element in the XML document below: Here's the code: Dim xmldoc As XDocument = XDocument.Load(theXMLSource1) Dim ql As XElement = (From ls In xmldoc.Elements("LabService") _ Where CType(ls.Element("ServiceType"), String).Equals("Scan") _ Select ls.Element("Price")).FirstOrDefault ql.SetValue("23") xmldoc.Save(theXMLSource1) Here's the XML file: <?xml version="1.0" encoding="utf-8"?> <!--Test XML with LINQ to XML--> <LabSerivceInfo> <LabService> <ServiceType>Copy</ServiceType> <Price>1</Price> </LabService> <LabService> <ServiceType>PrintBlackAndWhite</ServiceType> <Price>2</Price> </LabService> </LabSerivceInfo> But, I got this error message: Object reference not set to an instance of an object. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Error line:ql.SetValue("23") Can you show me what the problem is? Thank you.

    Read the article

  • LINQ - IEnumerable.Join on Anonymous Result Set in VB.NET

    - by user337501
    I've long since built a way around this, but it still keeps bugging me... it doesnt help that my grasp of dynamic LINQ queries is still shakey. For the example: Parent has fields (ParentKey, ParentField) Child has fields (ChildKey, ParentKey, ChildField) Pet has fields (PetKey, ChildKey, PetField) Child has a foreign key reference to Parent on Child.ParentKey = Parent.ParentKey Pet has a foreign key reference to Child on Pet.Childkey = Child.ChildKey Simple enough eh? Lets say I have LINQ like this... Dim Q = FROM p in DataContext.Parent _ Join c In DataContext.Child On c.ParentKey = p.ParentKey Consider this a "base query" on which I will perform other filtering actions. Now I want to join the Pet table like this: Q = Q.Join(DataContext.Pet, _ Function(a) a.c.ChildKey, _ Function(p As Pet) p.ChildKey, _ Function(a, p As Pet) p.ChildKey = a.c.ChildKey) The above Join call doesnt work. I sort of understand why it doesnt work, but hopefully it'll show you how I tried to accomplish this task. After all this was done I would have appended a Select to finish the job. Any ideas on a better way to do this? I tried it with the PredicateBuilder with little success. I might not know how to use it right but it felt like it wasnt gonna handle the joining.

    Read the article

  • StackOverflow in VB.NET SQLite query

    - by Majgel
    I have an StackOverflowException in one of my DB functions that I don't know how to deal with. I have a SQLite database with one table "tblEmployees" that holds records for each employees (several thousand posts) and usually this function runs without any problem. But sometimes after the the function is called a thousand times it breaks with an StackOverflowException at the line "ReturnTable.Load(reader)" with the message: An unhandled exception of type 'System.StackOverflowException' occurred in System.Data.SQLite.dll If I restart the application it has no problem to continue with the exact same post it last crashed on. I can also make the exactly same DB-call from SQLite Admin at the crash time without no problems. Here is the code: Public Function GetNextEmployeeInQueue() As String Dim NextEmployeeInQueue As String = Nothing Dim query As [String] = "SELECT FirstName FROM tblEmployees WHERE Checked=0 LIMIT 1;" Try Dim ReturnTable As New DataTable() Dim mycommand As New SQLiteCommand(cnn) mycommand.CommandText = query Dim reader As SQLiteDataReader = mycommand.ExecuteReader() ReturnTable.Load(reader) reader.Close() If ReturnTable.Rows.Count > 0 Then NextEmployeeInQueue = ReturnTable.Rows(0)("FirstName").ToString() Else MsgBox("No more employees found in queue") End If Catch fail As Exception MessageBox.Show("Error: " & fail.Message.ToString()) End Try If NextEmployeeInQueue IsNot Nothing Then Return NextEmployeeInQueue Else Return "No more records in queue" End If End Function When crashes, the reader has "Property evaluation failed." in all values. I assume there is some problem with allocated memory that isn't released correctly, but can't figure out what object it's all about. The DB-connection opens when the DB-class object is created and closes on main form Dispose. Should I maybe dispose the mycommand object every time in a finally block? But wouldn't that result in a closed DB-connection?

    Read the article

  • Problem sub-total Matrix with rdlc report in vb.NET

    - by Keven
    Hi everyone, I have a matrix and I need to add the money earned this year and past years. However, I must remove the money spent in past years. I must have the separate amount per year and the total of these amounts. This is what gives my matrix: Year = Fields!Year.value =formatnumber((sum(Fields!Results.Value))-(sum(iif( Fields!Year.value & Parameters!choosedYear.Value, Fields!Moneyspent.value,0))), 2) & "$" However, the subtotal gives me an error. What should I do? P.S.: I already found that the subtotal gives me an error because it's not in the scope of the rowgroup1, but is there a way to get the scope in the subtotal? or can anybody find another way to do it?

    Read the article

  • Load richtextbox from memorystream. WPF/VB>NET

    - by Peter
    Hi, I have some trouble with loading a richtextbox from a memorystream. I have some data in a database table stored as a byte array, I convert it to a string and load it into a memorystream and then I want to load that memory stream in the richtextbox. The application breaks on Dim tr As New TextRange(rtbTemplate.Document.ContentStart, rtbTemplate.Document.ContentEnd) though. Code for getting the data from the database Dim TemplateData As Byte() = TemplateDataTableInstance.Rows(0).Item("TemplateData") Dim strTemplateData As String Dim enc As New System.Text.UTF8Encoding() strTemplateData = enc.GetString(TemplateData) ' I put a messagebox here to check if I get the data I want and I do Now, how do I sort out the rest? I have Dim strDataFormat As String = DataFormats.Rtf Using ms As New MemoryStream(strTemplateData) Dim tr As New TextRange(rtbTemplate.Document.ContentStart, rtbTemplate.Document.ContentEnd) tr.Load(ms, strDataFormat) End Using and my richtextbox in xaml <RichTextBox x:Name="rtbLetter"> <RichTextBox.Resources> <Style TargetType="{x:Type Paragraph}"> <Setter Property="Margin" Value="0"/> </Style> </RichTextBox.Resources> <FlowDocument FontSize="12" FontFamily="Times New Roman"> </FlowDocument> </RichTextBox> Any help is appreciated.

    Read the article

  • VB.net Unique Hardware ID ideas

    - by xzerox
    I was wondering if there would be anything else I could use in my Hardware ID protection that would make it much more unique. I am currently using Processor ID Volume ID Mac Address Graphics Card Name If you guys can provide source codes to anything else that would make it even more unique please tell me.

    Read the article

  • vb.net string concatenation string + function output + string = string + function output and no more

    - by Barfieldmv
    The following output produces a string with no closing xml tag. m_rFlight.Layout = m_rFlight.Layout + "<G3Grid:Spots>" + Me.gvwSpots.LayoutToString() + "</G3Grid:Spots>" This following code works correctly m_rFlight.Layout = m_rFlight.Layout + "<G3Grid:Spots>" + Me.gvwSpots.LayoutToString() m_rFlight.Layout = m_rFlight.Layout + "</G3Grid:Spots>" 'add closing tag What's going on here, what's the reason the first example isnt working and the second is? The gvwSpots.LayoutToString() function returns a string.

    Read the article

  • VB .NET DirectCast and Type Reflection

    - by msarchet
    The application that I am working on has a generic Parent Form called RSChild, that is used to perform some operations depending on whether or not the control that is contained within it is in a MdiTabManager or inside of its own modal form. Then the actual User Controls contained within Inherit from a Interface Called ObjectEdit (Objects that we allow to be edited). At a point in my code I am doing this. Public Function doesTabExist(ByVal id As Integer, ByVal recordType As Enums.eRecordType) As Boolean Dim alikePages As Object = (From tabs In DirectCast(Control.FromHandle(MainForm.SharedHandle), MainForm).XtraTabbedMdiManager1.Pages Where DirectCast(tabs.MdiChild, RSChild).RSObject.RecordType = recordType Select tabs) For Each page As DevExpress.XtraTabbedMdi.XtraMdiTabPage In alikePages Select Case recordType Case Enums.eRecordType.Doctor If id = DirectCast(castTabPageToRSChild(page).RSObject, UI.Doctor).ID Then pageToActive(page) Return True End If 'rest of the cases so the case block is repeated 10 times' End Function And my castTabPageToRSChild(page) is a lambda function as Such Dim castTabPageToRSChild As Func(Of DevExpress.XtraTabbedMdi.XtraMdiTabPage, RSChild) = Function(page) DirectCast(page.MdiChild, RSChild) So my Question is, I have about 10 case statements, all because I can't seem to find a way to use reflection to get the underlying Type of the RSObject Object. So I have the whole If block repeated over and over. I tried doing castTabPageToRSChild(page)RSObject.GetType and using that in the DirectCast and I also tried creating another object that was separate from that and doing the same thing. My code works as intended I'm just trying to see if there is a manner in which I didn't have a lot of replicated code. My vision would be to do something like For Each page As XtraMdiTabPage In alikePages If id = DirectCast(castTabPageToRSchild(page).RSObject, TypeOfThatObject).Id Then Return True Next However I have a feeling this is not possible due to the behavior of DirectCast.

    Read the article

  • Read from multiple tables in vb.net data reader

    - by user225269
    I'm trying to read from two tables in mysql: Dim sqlcom As MySqlCommand = New MySqlCommand("Select * from mother, father where IDNO= '" & TextBox14.Text & "' ", sqlcon) -But I get this error: Column 'IDNO' in where clause is ambiguous Here is the whole code: Dim NoAcc As String Dim NoAccmod2 As String Dim NoPas As String Dim sqlcon As New MySqlConnection("Server=localhost; Database=school;Uid=root;Pwd=nitoryolai123$%^;") Dim sqlcom As MySqlCommand = New MySqlCommand("Select * from mother, father where IDNO= '" & TextBox14.Text & "' ", sqlcon) sqlcon.Open() Dim rdr As MySqlDataReader rdr = sqlcom.ExecuteReader If rdr.HasRows Then rdr.Read() NoAcc = rdr("IDNO") If (TextBox14.Text = NoAcc) Then TextBox7.Text = rdr("MOTHER") If (TextBox14.Text = NoAcc) Then TextBox8.Text = rdr("MOTHER_OCCUPATION") If (TextBox14.Text = NoAcc) Then TextBox10.Text = rdr("FATHER") If (TextBox14.Text = NoAcc) Then TextBox11.Text = rdr("FATHER_OCCUPATION") End If -Any suggestions that could help solve this problem? Or even other techniques on achieving the goal of reading data from two tables using data reader? This is a winform, not a web form

    Read the article

  • export to excel from vb.net from sql datareader

    - by reffer
    I have an sql query with sql datareader. i put a for loop for the data reader. now when the data starts coming in from the query i want it to export to excel in the for loop. here's my code Try Dim SqlStr As String = "", dr As SqlDataReader = Nothing ConnectDB(Cnn) Str = "query" SqlCmd = New SqlCommand(Str, Cnn) dr = SqlCmd.ExecuteReader while dr.read ..EXPORT TO EXCEL do end while does anyone know how to do this?

    Read the article

  • vb.net A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in ms

    - by prasoon99
    I just installed Visual Basic 2010 Express. I created a simple console application: Module Module1 Sub Main() Dim i As Integer i = 0 End Sub End Module I'm getting the following error SIX times before I get to line "i = 0": A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll Can anyone help? Why is this happening? Is there something wrong with my configuration? -Prasoon

    Read the article

  • ASP.NET/VB.NET problem solving help!

    - by Jonesy
    Hi folks, Got a problem I need help with. Basically I'm gonna develop a form (part of a bigger web app) that lists a load of clients and there business contact, tech contact 1, and tech contact 2. The idea is rapid data entry. So one form shows each client with their contacts in dropdowns and I we can change each one then click a save button to do a mass save. the database looks like this: tblClient ClientID ClientName BusinessContact Tech1 Tech2 My idea was to use a repeater to format the data like this: Client Business Contact Tech1 Tech2 Client2 Business Contact Tech1 Tech2 What I'm stuck on is how to do the mass update? Can I do something like for each item in Repeater1 then do an update SQL statement? -- Jonesy

    Read the article

  • Adding new record to a VFP data table in VB.NET with ADO recordsets

    - by Gerry
    I am trying to add a new record to a Visual FoxPro data table using an ADO dataset with no luck. The code runs fine with no exceptions but when I check the dbf after the fact there is no new record. The mDataPath variable shown in the code snippet is the path to the .dbc file for the entire database. A note about the For loop at the bottom; I am adding the body of incoming emails to this MEMO field so thought I needed to break the addition of this string into 256 character Chunks. Any guidance would be greatly appreciated. cnn1.Open("Driver={Microsoft Visual FoxPro Driver};" & _ "SourceType=DBC;" & _ "SourceDB=" & mDataPath & ";Exclusive=No") Dim RS As ADODB.RecordsetS = New ADODB.Recordset RS.Open("select * from gennote", cnn1, 1, 3, 1) RS.AddNew() 'Assign values to the first three fields RS.Fields("ignnoteid").Value = NextIDI RS.Fields("cnotetitle").Value = "'" & mail.Subject & "'" RS.Fields("cfilename").Value = "''" 'Looping through 254 characters at a time and add the data 'to Ado Field buffer For i As Integer = 1 To Len(memo) Step liChunkSize liStartAt = i liWorkString = Mid(mail.Body, liStartAt, liChunkSize) RS.Fields("mnote").AppendChunk(liWorkString) Next 'Update the recordset RS.Update() RS.Requery() RS.Close()

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >